otherside Posted April 15, 2003 Posted April 15, 2003 Hey guys Is there any way to add some bytes to a specific place in a file WITHOUT reading all the file in the memory ? Assume that the file is very large up to 200Mb i tried to use the append mode in conjuction with seek, but i get an exception that you can't seek in append mode so i assume that's not the way to do it Dim Fstr As New FileStream("test.txt", FileMode.Append) Dim data(10) As Byte Fstr.Seek(50, SeekOrigin.Begin) Fstr.Write(Data, 0, 10) Any ideas ? Quote
*Gurus* divil Posted April 16, 2003 *Gurus* Posted April 16, 2003 If you think about it, inserting bytes like that would mean physically moving the rest of the file (could be hundreds of megs) up by that number of bytes. You just can't do things like that. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
otherside Posted April 19, 2003 Author Posted April 19, 2003 Divil, thanks for your reply i know that, and i know in depth about that stuff, but there should be a way to do it. I mean how all the other applications can. Let's take the simplest winamp, when you changing a id3v2 tag it increases the size of the file instantly to write the information on the start of the file ? I know winamp is actually built on C++ (And i actually know how to do it in c) but there should be some class in the whole .net framework that does that. Quote
Leaders Squirm Posted April 19, 2003 Leaders Posted April 19, 2003 Winamp still has to rebuild the file when it wants to insert or remove data from the middle of a file. All applications do, it is the nature of our file system. There is no way to get around it. Quote Search the forums | Still IRCing | Be nice
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.