Thread: Standard Library file io under windows

  1. #1
    Registered User
    Join Date
    Jan 2005

    Standard Library file io under windows

    How does the C runtime library do file i/o in a windows app? The WinAPI has only the CreateFile and ReadFile as far as I can see where ReadFile reads a specified number of bytes rather than until lineend. So if one uses fgets to get a line at the time, does it use a 1-sized buffer until newline is detected? Does it use DOS routines? I'd like to use those funcs as described directly myself unless that's a terribly inefficient way to do it.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    It probably uses ReadFile to read a whole buffer full of bytes, then copies up to the first newline into the buffer you supply to gets
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM