[comp.lang.c] Problem with Microsoft C ver 3 and above under DOS 2.XX

rwh@we53.UUCP (01/08/87)

If you are runing MS-DOS 2.XX and use microsoft C version 3.00 and/or 4.0
the following code will cause some problems.

	FILE *fp;

		fp = fopen( "prn", "w" );
		.
		.
		.
		fclose(fp);

Not necessarily on the first time through, but some subsequent time the
above will lock up the computer, and cause it to display random system 
error messages and generally go crazy. The above happens ANYTIME an attempt
to fopen a character device. Micosoft claimed that the problem was in DOS
not their run-time library, It seems to run correctly under DOS 3.XX.

I'm not sure  if the above has been fixed under ver 4.00 of the compiler, but
stat always returns -1 on a character device under DOS 2.XX with errno set
to 0. Stat works correctly under DOS 3.XX.

Also the above code ran fine with Aztec C86 compilers, so what's wrong with
DOS? or Microsofts C ? Has anyone else discovered this problem? My clone dosen't
have DOS 3 (its an orphan), but I saw the problems listed above on IBMs, Eagles,
and Compaqs.


						Web Homer

michael@orcisi.UUCP (01/09/87)

> If you are runing MS-DOS 2.XX and use microsoft C version 3.00 and/or 4.0
> the following code will cause some problems.
> 
> 	FILE *fp;
> 
> 		fp = fopen( "prn", "w" );
> 		.
> 		.
> 		.
> 		fclose(fp);

You could just fprintf( stdprn, ... ); stdprn is predefined and "pre-opened"
(but you probably trying to do something slightly different).