Hi ..
I want to read a file... its easy to read.. but i have to read and put the data it into a seperate variable..for that i have to separate the commas and blank space.
for example:
A file called "midsemarks.txt" contains ..
01,0923916,NIKHIL S PANDE,0A,47.34
02,09D01020, HARSHSOMANI,0A,29
....
From the above, I have to take the value separately and store it in a corresponding variable..
variables are
int serialno[10]; string rollno[10],name[10],batchno[10];float marks[10].
Read the file one line at a time (getline) into a std::string.
Then, to pull out the individual fields, use std::string::find() to find the indices of the commas.
Then, use std::string::substr() to pull out "sub-strings" from the string.