Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FOPEN - buffered vs. not
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01682383
Message ID:
01682464
Views:
117
Likes (1)
You should always open files buffered as that is much faster than unbuffered. Windows already buffers file operations natively, but this affects how quickly FoxPro can read the data into memory. It won't make a noticeable difference on small files (because the overhead is mostly in opening and closing) but on large files it can make a very big difference.

Buffered is the default if you don't specify it and you should leave it at that - unless you have a very good reason to not buffer. Which I can't think of a good reason for to be honest. Read should never not buffer. Write - maybe you need to write small chunks of data in real time while another app monitors the file (possible in shared write mode for example), but FFlush() can serve that same purpose usually more effectively.

+++ Rick ---


>Hi all,
>
>When using FOPEN, there are the options for read only or buffered/unbuffered.
>
>If I am just reading a static file on disk, that is not open by anyone else, should I used buffered or unbuffered. I am asking because the help file does not really say what buffering does so hard to know which to use. Does buffered means the file is loaded into memory? I only need to read the first 1000 bytes of a file before doing something else with the whole file.
>
>Thanks,
>Albert
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform