Hi friends,
I have a file with mixture of strings and integers like this
I know exactly where the string or an integer is in the file.Code:aaaa 1
bbbb 2
cccc
dddd 3 eeee 4
So I need to do something like this. I need to read the string "aaaa" first, then I will read 1, then I'll read "bbbb", then 2 and so on.
Is there any way in which I can do the above. Something like readNextString() or readNextInteger().
I know I can use BufferedReader and read lines and do manipulation on each lines. But I am looking for something that we have in C++ like shown below
Code:int number;
char name[10] ;
ifstream in("test.txt");
if (in.is_open())
{
in >> name; [I][COLOR="YellowGreen"]//gets "aaaa" here[/COLOR][/I]
in >> number; [COLOR="YellowGreen"][I]//gets 1 here[/I][/COLOR]
[I][COLOR="YellowGreen"]//and so on[/COLOR][/I]
}

