Tony,
I don't think that there is an easy way to do this. What I would do is
create a new temp file and then write your information. Once you have that,
I would open the other file and then write the contents of the file to the
temp file after the information you have written.
Finally, you would delete the old file and then copy the temp file over
to the old file location when done.
If you want this all to happen in the same file, then you might want to
create a memory-mapped file and then perform a memory copy (CopyMemory) to
shift the contents of the file over and then write your data at the
beginning of the file.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Tony" <La*********@homeandresting.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi
I am writing text to a fileusing the streamwriter writeline method.
When creating the streamwriter it can be opened to append text to a file.
Is there a way, not necessarily with streamwriter, that I can open a file
and prepend text, so that the newly added data appears at the head of the
file?
Thanks
Tony