bug-ocrad
[Top][All Lists]
Advanced

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

Re: [Bug-ocrad] OCRAD with Visual Studio 2010 success


From: Antonio Diaz Diaz
Subject: Re: [Bug-ocrad] OCRAD with Visual Studio 2010 success
Date: Thu, 12 Aug 2010 16:39:26 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Tilman Hausherr wrote:
#if defined(__MSVCRT__) || defined(_MSC_VER) || defined(__OS2__)
 setmode( fileno( stdin ), O_BINARY );
 setmode( fileno( stdout ), O_BINARY );
#endif

Yes that works. Although I see no reason to set stdout to binary too,
except for philosophical reasons.

If you try verbose help (ocrad -v -h) you can see ocrad also produces binary pnm files:
  ...
  -1..6                    pnm output file type (debug)
  -C, --copy               'copy' input to output (debug)
  ...


And given that the 'x' mode has been added to the C1X standard, probably the best option is you patch it until Visual C++ 201X implements it.

An alternative might be this (at the bottom):
https://www.securecoding.cert.org/confluence/display/seccode/FIO03-C.+Do+not+make+assumptions+about+fopen()+and+file+creation

That solution is ugly. It has two possible errors to handle instead of one. I think it is just too much just to work around a temporary shortcoming of a proprietary compiler.


Best regards,
Antonio.



reply via email to

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