J
japi
Hi,
i would like to know what approach i should use to insert (not append)
a line of text to the begin of an existing text file.
My current approach works, but i am afraid of loosing data if an
exceptions is thrown somewhere in between the process.
My current approach:
1. read current contents of the file
2. create a filestream object (with FileMode.Create) wrapped in a
streamwriter object
3. write the new line of text
4. write the content that was read in step 1
im looking for a more transactional approach.
Thanks in advance.
Cheers,
Jaap
i would like to know what approach i should use to insert (not append)
a line of text to the begin of an existing text file.
My current approach works, but i am afraid of loosing data if an
exceptions is thrown somewhere in between the process.
My current approach:
1. read current contents of the file
2. create a filestream object (with FileMode.Create) wrapped in a
streamwriter object
3. write the new line of text
4. write the content that was read in step 1
im looking for a more transactional approach.
Thanks in advance.
Cheers,
Jaap