Truncate file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a text file. I want to delete the second part of file. How can I
delete the second half from file?

For example:
in file is:

Sentence 1.
Sentence 2.

and I want to delete from file "Sentence 2."

Thanks a lot

Lubos
 
I have a text file. I want to delete the second part of file. How can I
delete the second half from file?

For example:
in file is:

Sentence 1.
Sentence 2.

and I want to delete from file "Sentence 2."

You need to find the exact position in the file - in bytes, not
characters - and call FileStream.SetLength.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

PowerPoint Powerpoint Slow Animations 2
MSI script 1
Double space - period shortcut? 2
Help with sorting needed 2
Need some help to understand two sentences 5
How to copy icons used by VS? 13
Question with BinaryReader 6
dataadapter.fill slow 2

Back
Top