Jump to content
  • Advertisement

Archived

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

MPG

infile.get?

This topic is 5381 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!