newlib/winsup/mingw/samples/fmode/test.c
Danny Smith 7c3de623b6 * include/fcntl.h (_fmode): Remove declarations and
compatibility defines.
	(_setmode, setmode): Remove prototypes.
	* include/stdlib (_fmode): Add declarations and
	compatibility defines.  Change type to int.
	* include/io.h (_setmode, setmode): Add prototypes.
	* samples/fmode/all.c: Adjust includes.
	* samples/fmode/test.c: Likewise.
	* crt1.c (_CRT_fmode): Declare as int.
	* CRTfmode.c (_CRT_fmode): Likewise.

	* include/stdlib: Remove comment about MB_CUR_MAX.
2002-10-03 00:49:21 +00:00

33 lines
609 B
C

/*
* A sample program demonstrating how to use fmode to change the default
* file opening mode to binary. NOTE: Does not change stdin, stdout or
* stderr.
*
* THIS CODE IS IN THE PUBLIC DOMAIN.
*
* Colin Peters <colin@fu.is.saga-u.ac.jp>
*/
#include <stdio.h>
#include <stdlib.h> /* _fmode */
#include <fcntl.h> /* _O_BINARY */
main ()
{
char* sz = "This is line one.\nThis is line two.\n";
FILE* fp;
_fmode = _O_BINARY;
printf (sz);
/* Note how this fopen does NOT indicate "wb" to open the file in
* binary mode. */
fp = fopen ("test.out", "w");
fprintf (fp, sz);
fclose (fp);
}