By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

clearing a file and writing from the begining and then appending c++

P: 11
hii
i have to write into a file from the start and then go on appending to it .. i tried using ( ios::out|ios::app) but by this the file keeps on appending every time i run the program and the file ends up containing valuers from the previous runs as well... actually i am using a loop , which generates different values which are to be added to the file .
can some1 help me with this
i am fairly new to c++
Jun 13 '07 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
Append usally means add to the end of the current file. So that part is working.

Onn each run have you positioned to the beginning of the file using ios::beg??
Jun 13 '07 #2

P: 11
Append usally means add to the end of the current file. So that part is working.

Onn each run have you positioned to the beginning of the file using ios::beg??
got it .. thankyou.. :)
Jun 15 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.