What happened to io.h?

I'm using Visual C++ 2005 version 55537-000-0000016-00168 and the only place I can find io.h is in C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\io.h.  Is that intentional

Thanks,
Keith MacDonald




Answer this question

What happened to io.h?

  • mister_ray

    Hi Keith,

    This was a bug in one of the intermediate release. In the Beta 2 release you can find this file in the Microsoft Visual Studio 8\VC\Include directory, the expected place.

    Ronald Laeremans
    Visual C++ team

  • jason duncan

    It is not correct to say that Visual C++ doesn't support those functions, as the code below works.  MS would make the porting of old code a lot easier if they copied that io.h file to the normal include folder.  I suspect that this is simply a problem with the beta release, because the Visual Studio 2005 documentation still describes Low-Level I/O.

    #include <stdio.h>
    #include <fcntl.h>
    #include "C:/Program Files/Microsoft Visual Studio 8/VC/crt/src/io.h"

    void main()
    {
     int fd = open("/windows/win.ini", O_RDONLY);

     if (fd != -1) {
      int  nb = lseek(fd, 0, SEEK_END);
      char* pBuf = new char[nb];

      lseek(fd, 0, SEEK_SET);
      nb = read(fd, pBuf, nb);
      close(fd);
      write(1, pBuf, nb);
      delete [] pBuf;
     }
    }



  • Abdul lateef

    Hi Keith,

    It was fixed after that. I verified this on build 050215.

    Ronald

  • SuryaGopi

    Just to clarify, while build 50110 says "Beta 2" on the splash-screen (etc), it's really the Feb 2005 CTP - a Pre-Beta 2 release.

  • Grego

    Fair enough, but why make things difficult for writers of portable software, by eliminating the non-underscored prefix declarations for open, close, read, write, lseek etc.

  • Tim Sohn

    Well, io.h is not nor has never been a part of the ANSI/ISO C and C++ standards. It is meant for internal use for the implementation of the standard C/C++ libraries that ship with Visual C++. I'm not sure of the exact reason for removing it from the public /include directory, but if it was intentional, I bet you it is because they wanted to limit the amount of proprietary stuff exposed through the public portion of the standard library interface. Your best bet is to stear clear of using the functions and types in io.h as they are not portable, and they are subject to change in the future as it is not standardized. Instead, use the io routines in stdio.h/cstdio (C/C++ respectively), or the C++ input/output streams.



  • John Cronin

    open, close, read, write and lseek are all part of Posix, which Visual C++ doesn't support. What you're looking at is some functions which happen to have the same names as some functions elsewhere. Take a look at Microsoft Services for Unix, or Cygwin. Both of these let you build and run Posix apps on Windows, and they're both free. -- Tim Robinson MVP, Windows SDK wrote in message news:da0e5276-7f78-401f-9a58-7a0055ddfc86@discussions.microsoft.com... Fair enough, but why make things difficult for writers of portable software, by eliminating the non-underscored prefix declarations for open, close, read, write, lseek etc
  • takashikatori_9000

    Hi Ronald,

    Thanks for clearing this up, although I thought I had Beta 2 (8.0.50110.28), so perhaps it was fixed after that.

    Keith MacDonald

  • What happened to io.h?