how to determine what type of content does a file contain?

i have to create a program to isolate string, float and integer values in a file that may be located randomly in the file. how do i determine it?
Any idea if these values will be on their own line?

They at least need to be separated by spaces for the program to recognize them as separate entities, so read them in as strings, check for the existence of a numbers and a decimal point (for the FP number).

If it has numbers and the string will not contain ANY numbers, you then check for the decimal point. No decimal point: integer.

If it has no numbers, it's a string.
yeah they are seperated by spaces and has a new line character after 20 characters. how do i check for the existence of numbers? Do i use typeid or something else?
I would just do a search of the string.

http://www.cplusplus.com/reference/string/string/

Go to the bottom group of operations and read up on the find functions.

Topic archived. No new replies allowed.