hi
i have problem , i want to modify a file without copy to another file so any one can give how to do it ? I tried following method to modify a given location or pointer in file but did not work .
ofstream outfile;
outfile.open ("test.txt");
outfile.seekp (3,ios::beg);
outfile<<5;
outfile.seekp (12,ios::beg);
outfile<<9;
sonu_1
Recommended Answers
Jump to PostWhen you said "did not work", please be specific. I know what happened, but that's only because I can deduce it due to experience. Not everyone may be able to immediately call from memory that opening a file in write mode will truncate the file to 0 bytes. You can …
All 7 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
sonu_1
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
sonu_1
sonu_1
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.