open, close, dup, dup2, lseek, read, write, fileno, etc.
    Walter Bright 
    newshound1 at digitalmars.com
       
    Fri Feb  8 18:40:12 PST 2008
    
    
  
Janice Caron wrote:
> open, close, dup, dup2, lseek, read, write, fileno, etc....
> 
> Is there any good reason why these functions are available in Phobos
> for the Linux version of D only, but not for the Windows version?
> 
> These functions certainly do exists on Windows (albeit with names
> preceeded by a single underscore). In C and C++, you just have to
> #include <io.h>
> 
> I looked at the source code for std.streams, just to end my confusion
> about what File does, and it turns out it's full of lots of
> conditional code, with Windows using Windowsy functions like
> CreateFileW() and CreateFileA(). I'm sure there's probably a good
> reason for this - I just don't know what it is. Can anyone explain?
Going directly to the underlying OS functions makes for faster, more 
efficient I/O. Calling open, close, etc., on Windows makes for poor 
performance, because those functions are layered on top of the Windows 
I/O functions.
    
    
More information about the Digitalmars-d
mailing list