Read max value from strings of numbers in text file
I have a text file with a thousands of rows of numbers in it.
1 2 4 6 11 13 19 21 66 97 101 ........
1 3 9 12 18 26 44 56 98 113......
What I want to do is find the maximum number that's in the file.
My thoughts are:
1 - the numbers are all strings, not integers, so I can't easily get the max val.
2 - do I need to use an array to store all the numbers in and calculate the max val from there?
3 - do I need to use itoa to convert the strings into integers?
4 - I need some way of making the program recognise a whole number (i.e. read in the data until you get to a space and then it will know its got a whole number).
Can anyone help me? Is there some fairly straight forward code I can use to do this?