CFile or CStdiofile : inserting text to begining of a existing file
-
Hi, I want to add some text to the begining of a existing text file while keping its contents. I used SeekToBegin method but it overwrites the contents already in the file. Is there a way to do that?
-
Hi, I want to add some text to the begining of a existing text file while keping its contents. I used SeekToBegin method but it overwrites the contents already in the file. Is there a way to do that?
I presume you can't do that! instead what u can do is open another temp file, and write the contents at the start of the temp file. and copy entire contents from the old file to temp file. After that replace old file by temp file. -- reddy
-
I presume you can't do that! instead what u can do is open another temp file, and write the contents at the start of the temp file. and copy entire contents from the old file to temp file. After that replace old file by temp file. -- reddy
Yes, But what if the contents of the old file is really large. Will that be a problem in efficiency?
-
Hi, I want to add some text to the begining of a existing text file while keping its contents. I used SeekToBegin method but it overwrites the contents already in the file. Is there a way to do that?
-
Hi, I want to add some text to the begining of a existing text file while keping its contents. I used SeekToBegin method but it overwrites the contents already in the file. Is there a way to do that?
Open the file in different mode or flag
-
Yes, But what if the contents of the old file is really large. Will that be a problem in efficiency?
u have to follow the same procedure even if the contents are very very large. Because except Xenix, no other OS provide insertion of bytes in the middle of the file, they support insertion only at the end of the file. -- reddy
-
Hi, I want to add some text to the begining of a existing text file while keping its contents. I used SeekToBegin method but it overwrites the contents already in the file. Is there a way to do that?