Commit 1b771238 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Improve error messages of SSCANF

parent 5fec19e9
......@@ -225,7 +225,7 @@ MANY_REALLOCATIONS(&values, 7);
#define FSCANF(fields_nb, file, ... ) do{if (fscanf(file, __VA_ARGS__) != fields_nb) EXIT_ON_ERROR("Failed reading %d fields.", fields_nb);}while(0)
/// Do a fscanf checking than the number of interpreted arguments corresponds to the first parameter.
#define SSCANF(fields_nb, string, ... ) do{if (sscanf(string, __VA_ARGS__) != fields_nb) EXIT_ON_ERROR("Failed reading %d fields in '%s'.", fields_nb, string);}while(0)
#define SSCANF(fields_nb, string, ... ) do{if (sscanf(string, __VA_ARGS__) != fields_nb) EXIT_ON_ERROR("Failed reading %d fields in '%s' from buffer '%s'.", fields_nb, string, STRINGIFY(string));}while(0)
/// Like FSCANF but generates only a warning in case of error.
#define TRY_FSCANF(fields_nb, file, ... ) do{if (fscanf(file, __VA_ARGS__) != fields_nb) PRINT_WARNING("Failed trying reading %d fields in '%s'.", fields_nb);}while(0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment