diff options
Diffstat (limited to 'winsup/mingw/samples/fmode')
-rw-r--r-- | winsup/mingw/samples/fmode/all.c | 49 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/jamfile | 7 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/readme.txt | 5 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/test.c | 32 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/test2.c | 37 |
5 files changed, 0 insertions, 130 deletions
diff --git a/winsup/mingw/samples/fmode/all.c b/winsup/mingw/samples/fmode/all.c deleted file mode 100644 index f052b9306..000000000 --- a/winsup/mingw/samples/fmode/all.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * A sample program demonstrating how to use _CRT_fmode to change the default - * file opening mode to binary AND change stdin, stdout and stderr. Redirect - * stdout to a file from the command line to see the difference. - * - * Also try directing a file into stdin. If you type into stdin you will get - * \r\n at the end of every line... unlike UNIX. But at least if you - * redirect a file in you will get exactly the characters in the file as input. - * - * 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 */ -#include <io.h> /* _setmode */ - - -unsigned int _CRT_fmode = _O_BINARY; - -main () -{ - char* sz = "This is line one.\nThis is line two.\n"; - FILE* fp; - int c; - - printf (sz); - - /* Note how this fopen does NOT indicate "wb" to open the file in - * binary mode. */ - fp = fopen ("all.out", "w"); - - fprintf (fp, sz); - - fclose (fp); - - if (_isatty (_fileno(stdin))) - { - fprintf (stderr, "Waiting for input, press Ctrl-Z to finish.\n"); - } - - while ((c = fgetc(stdin)) != EOF) - { - printf ("\'%c\' %02X\n", (char) c, c); - } -} - diff --git a/winsup/mingw/samples/fmode/jamfile b/winsup/mingw/samples/fmode/jamfile deleted file mode 100644 index 5b7a1cb06..000000000 --- a/winsup/mingw/samples/fmode/jamfile +++ /dev/null @@ -1,7 +0,0 @@ - -Main test.exe : test.c ; - -Main test2.exe : test2.c ; - -Main all.exe : all.c ; - diff --git a/winsup/mingw/samples/fmode/readme.txt b/winsup/mingw/samples/fmode/readme.txt deleted file mode 100644 index b865bfd4e..000000000 --- a/winsup/mingw/samples/fmode/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ - -These two demos show how _fmode and _CRT_fmode can be used to modify the -default file opening mode (text vs. binary) and/or the mode of the standard -file handles. - diff --git a/winsup/mingw/samples/fmode/test.c b/winsup/mingw/samples/fmode/test.c deleted file mode 100644 index 0ec364534..000000000 --- a/winsup/mingw/samples/fmode/test.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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); -} - diff --git a/winsup/mingw/samples/fmode/test2.c b/winsup/mingw/samples/fmode/test2.c deleted file mode 100644 index b7d6b1891..000000000 --- a/winsup/mingw/samples/fmode/test2.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * A sample program demonstrating how to use fmode to change the default - * file opening mode to binary. Compare this file, which sets _fmode - * at file level to test.c, which sets the dll variable directly within - * main. - * NOTE: Does not change stdin, stdout or stderr. - * - * THIS CODE IS IN THE PUBLIC DOMAIN. - * - * Colin Peters <colin@fu.is.saga-u.ac.jp> - * Danny Smith <dannysmith@users.sourceforge.net> - */ - -#include <stdio.h> -#include <stdlib.h> /* _fmode */ -#include <fcntl.h> /* _O_BINARY */ - -#undef _fmode -int _fmode = _O_BINARY; - -main () -{ - - char* sz = "This is line one.\nThis is line two.\n"; - FILE* fp; - - printf (sz); - - /* Note how this fopen does NOT indicate "wb" to open the file in - * binary mode. */ - fp = fopen ("test2.out", "w"); - - fprintf (fp, sz); - - fclose (fp); -} - |