char ch;
while(in.good()) in.get(ch); //get characters 1 by 1....
there you go...
When reading from an unformatted file (every file contains bytes, you can't limit your question to just text files: all of them are "text" files), you generally have to check the "format" to make sure that there is legible information to read. For example, if each line is (supposed to be) null-terminated, you could check to see if there are any '\0' characters in the file (meaning there is data). there are many different ways to read information. I'm sure there's somthing "standard" (like encoding, etc...) but generally, C++ lets you read files any way you want to (reverse, forwards, up/down, side side, round in round, you name it, but you will have to emplement it first ;))
If you're asking for somthing specific, then you should say it.
I wouldn't recommend doing the way that IWishIKnew mentioned. You are better off doing
1 2 3 4
while(in >> input)
{
//do something with what ever was just read in
}
@Stephanie could you be a little more specific on what you are trying to do? If you have an formatted text file that almost seems like reading in arbitrary information. If you could show in an example file you are trying to read it would help us to help you. Reading in the actual information is really easy.
@giblit thanks. suppose I was to take a text file from out of my documents to input into my c++ program, how would I go about doing that? you understand?