C++/file handling
Expert: Prince M. Premnath - 10/17/2006
Questionhow to read line by line from a text file and differentiate between charecter data and integer data present in the line.
Answerdear harsha !
Here i give some idea's or tech's to do that!
1. Read a data file in terms of charecters.
2. You know how to differentiate a word from line !
( a word may be separated from a line at each encounter of
space , ; , ... )
device an algorithm in such a way it will read words insted of lines from a text file
3. convert the word using integer using atoi() function ,
if the function converts the given word structure into unteger then its a valid integer , else its a string.
4. Using this method you can easily differentiate integer and text from a text file .
Try it surely it will work
regards
Prince M . Premnath.