Jump to content
  • Advertisement
Sign in to follow this  
raptorstrike

fstream (fstream::ate fstream::out or just fstream::ate?)

This topic is 4822 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

ok i want to open a .txt file that has already been written to so i dont want to truncate the file in order to do this do i open with ate | out or just ate? Ive looked alot of place on the web but i seem to get conflicting info as to weather ate opens the file as write anyway thx =) [Edited by - raptorstrike on June 6, 2005 9:10:06 PM]

Share this post


Link to post
Share on other sites
Advertisement
two ways:
use ofstream, or fstream:

//ofstream
ofstream file("somefile.txt",ofstream::ate);

//or fstream
fstream file("somefile.txt",fstream::out|fstream::ate);


both produce the same results. fstream is mostly used for input and output, and ofstream can only be used for output.

So, to answer your question, I recommend doing this:
ofstream file("urfile.txt",ofstream::ate);

Share this post


Link to post
Share on other sites
awsome, thx

one last thing its really kind of unrelated to the topic but I dont want to clutter the forum with more threads, I have one header file that I want to include in all my other files but it has some function defentitions in it so when I include it in all of them i get multiple defenition errors I am using inclution gaurds and all that but it still gives me those same errors what to do?

ah nvrm i got it, just put those functions in a seprate .cpp file
thx again

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!