The latter part, "%[;]c" is a trick to detect if the whole string is read
Hello all,
I'm trying to use fscanf to read a certain string, using this formatting :
" someid=%u%[;]c"
The latter part, "%[;]c" is a trick to detect if the whole string is read : Only if the ";" is encountered the result of fscanf equals 2 (can't use "%n", as that doesn't up the result count).
Second question : Is there some way I can tell fscanf that it should match upto the terminating zero (so I can do away with the "%[;]c" cludge altogether) ?
If you're using fscanf there presumably isn't a terminating zero,
Of course whether this is worthwhile will depend on the details, eg
whether you
want to simply ignore and/or complain about badly formed lines, or whether you
want to abort the whole reading.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 185 |
Nodes: | 16 (1 / 15) |
Uptime: | 11:13:36 |
Calls: | 3,678 |
Calls today: | 4 |
Files: | 11,151 |
Messages: | 3,447,949 |