Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_core
Commits
1b771238
Commit
1b771238
authored
Jul 11, 2019
by
Arnaud Blanchard
Browse files
Improve error messages of SSCANF
parent
5fec19e9
Changes
1
Show whitespace changes
Inline
Side-by-side
include/blc_tools.h
View file @
1b771238
...
...
@@ -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)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment