problem with getting characters

hi,I dont have any idea about how we could read character from a text file.we should design agame and we can only use iostream fstream and string library.for example in a text we have 6 characters,which function I should use in order to get them and cout them in my consoul window?
thanks
Getting characters is the same for any type of standard stream. You can get characters from a file the same way you get them from cin. You can use

1
2
string line;
getline( inFile, line );


And that will get a line from the file. And if you have more than one line you can throw that whole statement into a while-loop as the condition.
Last edited on
To get a single character you can use inFile.get();
Topic archived. No new replies allowed.