>In the old days we did something like this:
>
>
>
>FILE = fopen()
>while ( !FEOF(FILE) )
>{
> ** Do something here reading or writing
>}
>
>
>
>This is the basic simple file manipulation we used in ANSI C and VFP.
>
>As far as I can tell C# has broken this down into stream readers, stream writers, file streams, file info objects, asynchronous readers and writers, blah blah blah. I don't want a reader and a separate writer. I want a reader/writer on the same existing file that I can read from and insert to.
>
>All I want to do is open a text file, search for certain strings, and insert text at those locations. Why is this such a pain? As near as I can tell I am going to need to open an existing file, read it into a new file with my changes, delete the old file, and rename the new one?
>
>Or perhaps spend another day reading and writing to a FileStream at the byte level?
>
>There must be an easier way to scan and edit a text file.
Eric,
FileStream covers that basic fopen() at a lowlevel.
If you directly work on same file you should be carefull about your position in file.
If your concern is only appending at the end then you might use:
StreamWriter sw = File.AppendText("filename.txt");
Cetin