Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why one code works, while other doesn't?
Message
From
24/01/2001 12:47:51
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00466654
Message ID:
00468016
Views:
35
>Looks like with FREAD() I have to re-position with FSEEK() after each read. Do you think it still would be faster? BTW, VFP Help on FREAD() is really scare. I checked Hacker's Guide, it doesn't show the maximum number of bytes for FREAD().

Reposition? Why? It will leave you exactly at the first unread byte. If you're writing a single pass parser, that's all you need. If you want to write stuff back into the same file, that'd be a different story - and keep in mind that, after removing the quotation marks, your resulting file would be shorter anyway. I wrote this example assuming you'll be creating a second file (even if it means killing the first one in the end). Writing it back into the same file would require to keep track of two locations: the beginning of the previous block, and the beginning of the next block, i.e. the write and the read position. You can obtain both using fseek() after each write or read.

I guess maximal number of bytes for FRead() was increased in 5 or 6; initially it was something like 8K or so. I've seen examples where FRead() was used instead of FileToStr() before the latter was introduced, which could mean you have the same limitation as for any other string (16M?).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform