hey guys how i read from files only int/or some char data
let say i have list of student name + grade in file
like
name1 80
name2 90
and i want to take from the file only the grades and not the name
i know how to handle files in c++ but still.
another quastion if i have the same name student + grades
and in the files its written like this:
name1|90
name2|30
how can i skip the name and the sign |.
i know how to handle seekg .
but the name have diffrent size .
any help i be really greatfull
Maybe a bit clearer if you break it into two pieces.
1 2 3 4 5 6 7
while (getline(file, name, '|')) //Reads text until '|' or the end of line into name while file is valid
{
cout << name;
file >> grade; // reads an int into grade
cout << "\t" << grade;
}