On Sun, Jan 18, 2009 at 9:44 PM, Luke Kenneth Casson Leighton lkcl@lkcl.net wrote:
On Sun, Jan 18, 2009 at 1:52 AM, Hin-Tak Leung hintak_leung@yahoo.co.uk wrote:
I am about to go back to fix a bug with ghostscript's ijs interface when compiled with non-MSVC: IJS is a binary protocol (for communicating with non-postscript printer drivers), but if you don't explicitly declare "wb" and "rb", and precise behavior - whether to do \n to \r\n translation - is dependent on both compilers (mingw, msvc, borland) and C runtime (wine or native windows). So if you want it to work correctly, you explicitly declare everything.
Mingw, msvcrt and from the looks of it Borland also, export a global variable named _fmode, which can be tested (or modified) to see what the default mode is, not sure how far this dates back or what the consistency is. The default does seem to be translated mode though.
http://msdn.microsoft.com/en-us/library/ee2849wt(VS.80).aspx
-Jeff