• Advertisement

Archived

This topic is now archived and is closed to further replies.

infile.get?

This topic is 5200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Here's a short example of how to take a text file and print it out on the console:


#include <fstream.h> //use fstream for textfile input/output


char c1;
ifstream file1;
file1.open("foo.txt", ios::in);
while(file1.get(c1))
cout << c1;


This may or may not include whitespace - I don't remeber.
I'm not sure if its considered good practice to add the ".h" to fstream but its the way I've always done it so there you go.

[edited by - Odoacer on January 24, 2004 9:36:23 PM]

Share this post


Link to post
Share on other sites

  • Advertisement