Public Group

# 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.

## 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 on other sites
two ways:
use ofstream, or fstream:
//ofstreamofstream file("somefile.txt",ofstream::ate);//or fstreamfstream 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.

ofstream file("urfile.txt",ofstream::ate);

##### 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

1. 1
2. 2
3. 3
4. 4
JoeJ
12
5. 5
Rutin
11

• 12
• 16
• 13
• 20
• 12
• ### Forum Statistics

• Total Topics
632178
• Total Posts
3004598

×