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: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:04:40 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,792 |