Advertisement Jump to content
Sign in to follow this  

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

This topic is 4972 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
two ways:
use ofstream, or fstream:

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!