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:23:02
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00466654
Message ID:
00467992
Views:
33
>>
>>  ih=fopen([filename], read_only)
>>  oh=fcreate([new filename])
>>  do while not feof(ih)
>>     cBuff=fread(ih, 8192)   && use any suitable round number
>>     cOutBuff=CrunchMunch(cBuff)
>>     =fwrite(oh, cOutBuff)
>>  enddo
>>  CloseEmAll
>>
>Your second point is interesting. Currently I do it by fgets() fputs(), but fread(), fwrite() should be more efficient, because I may use bigger number. Is 8192 is maximum size here? I'll check it.

Fgets() and FPuts() are line-oriented. FGets() will read it until the first cr, lf or pair of them - which means it'll use some sort of buffering, and then look for the EOL marker inside the buffer. That's overhead - and FPuts() will add the cr+lf at the end of line, which is also some overhead. FRead() just reads a bunch of bytes and checks for FEof() only (i.e. will give you a shorter string when you hit the end). With it, you do the buffering yourself, and in your case, you don't care of the CRs and LFs anyway, right?

> In the meantime I thought about creating a C FLL for this purpose, but I don't remember off hand String functions in C++. Perhaps, new libraries have strtran() analogue embedded. If you can help me with C++ code here, I'd appreciate it. I found an example of Cetin's FLL for parsing strings...

I'm C++ illiterate. I may be able to read the code to some extent, but it's been years since my last attempt to write some.

back to same old

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

Click here to load this message in the networking platform