diff options
| author | Clecio Jung | 2023-03-18 20:43:43 -0300 |
|---|---|---|
| committer | Clecio Jung | 2023-03-18 20:43:43 -0300 |
| commit | 0113ec2c4358a5a6f4ad473372a63d2aa3c249c0 (patch) | |
| tree | 18c1faa2ccebd38ca28511597cdbf031fc69e16b /README.md | |
| parent | a3942b3241189a003414874a96732e373e63ccae (diff) | |
| download | libini-0113ec2c4358a5a6f4ad473372a63d2aa3c249c0.tar.xz libini-0113ec2c4358a5a6f4ad473372a63d2aa3c249c0.tar.zst | |
Improve parsing
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -31,18 +31,30 @@ This library provides a set of functions for reading and writing INI files. Here int main(const int argc, const char **const argv) { struct Ini_File *ini_file; + + // Check that the user provided an argument specifying the INI file name if (argc < 2) { fprintf(stderr, "Usage: %s ini_file_name\n", argv[0]); return EXIT_FAILURE; } + + // Parse the INI file and store the resulting data structure in a variable ini_file = ini_file_parse(argv[1], NULL); + + // Check that the INI file was parsed successfully if (ini_file == NULL) { fprintf(stderr, "Was not possible to parse the ini_file \"%s\"\n", argv[1]); return EXIT_FAILURE; } + + // Print the properties from the INI file to the console printf("\nThe properties retrieved from the the ini file \"%s\" are:\n\n", argv[1]); ini_file_print_to(ini_file, stdout); + + // Free the memory used by the INI file data structure ini_file_free(ini_file); + + // Return 0 to indicate success return EXIT_SUCCESS; } ``` |
