help-cgicc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use Of _setmode()


From: Alexander J. Oss
Subject: Use Of _setmode()
Date: Tue, 12 Feb 2002 22:49:09 -0500

More Borland C++Builder 5 comments...

Line 48 of CgiEnvironment.cpp calls the functions _setmode() inside an
#ifdef WIN32, and that function (and its parameter _O_BINARY) doesn't exist
for Borland... I assume they are VC++ constructs.  Borland instead uses the
same stuff without the underscores.  I replaced the code with the following:

  // On Win32, use binary read to avoid CRLF conversion
#ifdef WIN32
#ifdef __BORLANDC__
  setmode(_fileno(stdin), O_BINARY);
#else
  _setmode(_fileno(stdin), _O_BINARY);
#endif
#endif

Note also that Borland's _fileno() requires <stdio.h>, which I added in the
#ifdef WIN32 which includes <io.h> and <fcntl.h> on line 34.

(And just for good measure, I got another "'pos' is assigned a value that is
never used" warning on line 95, another unneeded initialization to zero.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]