From 0113ec2c4358a5a6f4ad473372a63d2aa3c249c0 Mon Sep 17 00:00:00 2001 From: Clecio Jung Date: Sat, 18 Mar 2023 20:43:43 -0300 Subject: Improve parsing --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 76abf6d..220d1c1 100644 --- a/README.md +++ b/README.md @@ -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; } ``` -- cgit v1.2.3