I'm working with a C(++) program, who needs to read values from a file. Those values can be integers (signed or unsigned) or floating point numbers. At this moment the file only contains decimal numbers (integers), as a sscanf()
format specifier %d
seems to be sufficient.
However in future the file might contain all kinds of numbers, like positive or negative numbers (integers or floating point numbers) and in latter case, the precision is not known, neather the presence of leading or trailing zeroes, as in following examples:
1
+2
-34
12.5
-13.5
+00014.31000000
Is there a format specifier which can cover all those cases, or am I dreaming?
Thanks