View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1560_] Rick Rothstein \(MVP - VB\)[_1560_] is offline
external usenet poster
 
Posts: 1
Default Smart way to delete the first row of a huge file

Yes, a single string can contain 200MB of data; the actual limit is
approximately 2 billion (2^31) characters. So, the only restriction on how
well the code I posted will work is available RAM (I think a total of 400MB
would be necessary for your file... 200MB for the string as it is read into
the TotalFile variable and another 200MB for the temporary string I think
gets created by the Mid$ function call). If there is not enough available
RAM, the code should still work, but the system paging back out to the hard
drive would be a performance killer. (All this is why I asked you how huge
"huge" was.)

The # signs are part of the syntax for addressing a channel number to a file
(although in some of the locations I used it in, it may be optional). As for
the $ sign, String functions have two forms... without the $ sign, they
return variants with a subtype of String (variants are slow and memory
wasters... not usually a concern outside of large loops); with the $ sign,
they return a pure String data type (and hence, when used in further String
manipulations, are as efficient as the function will get).

Rick


"Charles" wrote in message
...
Actually, not sure it works. Your code requires to load the whole
200MB file into memory in one go. Which would be probably faster than
having an access to the drive for each line read/written. But that's
going to be a big ask for Excel. Actually can a single string contain
200MB of data?

I actually have another question: I never really understood the
meaning of the "#" character before variables, or the "$" sign after
the name of the function. How different is it from simply using mid()
or filenum?

Charles