I have a software that reads from a file. Each object in the software takes 7 inputs viz.
string string string float string float int
I have an input file. It contains a number of input values. If input for one object is like:
hss cscf "serving cscf" 32.5 ims 112.134 124
(Note: when an object's variable needs multi word string, I used "....", for single word string, it is without quotes)
How can I read it using ifstream? (I searched google but didn't find.)
I tried to read entire line using getline and but again got stuck when it came to find out whether its a single word or multi word input! I thought to read a line and then search char by char. If its '"', I know its a multi word. But I stuck when it comes to an integer or float. For char
, you can use if(line[i]>='a'&&line[i]<='z')
but how to go ahead when integer or float is the next value?
Please give some suggestions for this.