realbasic-plugins
[Top] [All Lists]

Re: Double-buffering read/write to files

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Double-buffering read/write to files
From: "Theodore H. Smith" <delete at elfdata dot com>
Date: Mon, 11 Dec 2006 20:34:41 +0000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=ZxM3Qr9GDErOrC5nd8mdVKp/77x6LzLUR9IXdfCwGBGCeOZVWOvvpqkD+OWScZI3efmtqSvmWBgpXR6cmraQwsI0DavLtqLTGjqKBVdmZuPzZsAlpczjxyZvN6ZjqgDjWRIAYLiYaDw6ypWF4z5oasTlcRMFNy+/Qwd9tmLoFcQ=
References: <557C772B-523C-457F-9A99-D5E7A0628387 at elfdata dot com> <60300C4A-3D6E-489F-8BAB-AC98685A9DBE at elfdata dot com> <457DBEFE dot 7060808 at Club-Internet dot fr>

On 11 Dec 2006, at 20:26, Menneteau wrote:

Thanks Mennetau, nice answer.

One more though. What is the difference between fopen and open?

Why is there an fopen call when open seems to do it all, and even better? Is fopen better buffered, or what?

Anyhow, for my case, I don't want any buffering.

Do you have any idea how I can ask the OS what is it's preferred file I/O read/write size?



Theodore H. Smith wrote:
Also, anyone know anything about double-buffering file streams?

So, basically, how I'd like it to work, is that ask for a read into the buffer, and return instantly before the read is complete! The user will process a previously made buffer. By the time he's finished processing it, the last read will be complete. If not, we'll actually just block until the read is complete.

Does fread offer such functionality? OR any standard Unix calls?

fread not, but read yes.
You control the read behavior with fcntl.
Basically, you can make the read asynchronous (O_NONBLOCK), you can be notified when data is available (O_ASYNC), and you can disable data caching (F_NOCACHE). This should work on Unix and Mac OS. I don't know how this works for windows.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>