Re: Truncate file
Tech-Archive recommends: Fix windows errors by optimizing your registry
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 13 Jun 2005 21:01:02 +0100
<<l>> wrote:
> 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.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
Relevant Pages
- Re: Raise event inside a thread
... using monitors or a ManualResetEvent. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.languages.csharp) - Re: get the actual size of a file
... saying for certain either way:) ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.languages.csharp) - Re: Threading/Locking
... Then you stash the data in an ordered list which is then processed by ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.languages.csharp) - Re: How to trigger other thread
... updates are "seen" or not. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.framework.windowsforms) - Re: MemoryStream.Write() Offset cannot be zero
... a file - it's just like that, except it all stays in memory. ... Jon Skeet - ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.framework) |
|