mark_s
asked on
ofstream question
I want to open a file and seek to the end of it, but whenever the file is opened using the following code, it is truncated...
std::ofstream queue;
queue.open("file.000", std::ios_base::out | std::ios_base::ate);
any suggestions?
std::ofstream queue;
queue.open("file.000", std::ios_base::out | std::ios_base::ate);
any suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
std::ios_base::ate sends you to the end of file, is that what you want?
Try using std::ios_base::trunc instead.
Example:
queue.open("file.000", std::ios_base::out | std::ios_base::trunc);
Example:
queue.open("file.000", std::ios_base::out | std::ios_base::trunc);
Oops!!!
Disregard my previous comment.
I belive jkr is right. app is what you want.
Disregard my previous comment.
I belive jkr is right. app is what you want.