diff options
author | Earnie Boyd <earnie@users.sf.net> | 2002-05-28 17:13:45 +0400 |
---|---|---|
committer | Earnie Boyd <earnie@users.sf.net> | 2002-05-28 17:13:45 +0400 |
commit | 4ad1e6fedbbdf47ea996f317de13d5cd5c5e206e (patch) | |
tree | 7700c41496acb60ac44c5885d954519aa52164cd /winsup/mingw/samples/fmode | |
parent | ad39fa8cb092eb6bb9ba5672f373751c89b1d4ff (diff) |
Merging MinGW changes
Diffstat (limited to 'winsup/mingw/samples/fmode')
-rw-r--r-- | winsup/mingw/samples/fmode/all.c | 92 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/jamfile | 10 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/readme.txt | 10 | ||||
-rw-r--r-- | winsup/mingw/samples/fmode/test.c | 62 |
4 files changed, 87 insertions, 87 deletions
diff --git a/winsup/mingw/samples/fmode/all.c b/winsup/mingw/samples/fmode/all.c index 52f93d1c1..a6f7d51f7 100644 --- a/winsup/mingw/samples/fmode/all.c +++ b/winsup/mingw/samples/fmode/all.c @@ -1,46 +1,46 @@ -/*
- * 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 <fcntl.h>
-
-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);
- }
-}
-
+/* + * 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 <fcntl.h> + +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 index 2c7f7d32f..33455ec59 100644 --- a/winsup/mingw/samples/fmode/jamfile +++ b/winsup/mingw/samples/fmode/jamfile @@ -1,5 +1,5 @@ -
-Main test.exe : test.c ;
-
-Main all.exe : all.c ;
-
+ +Main test.exe : test.c ; + +Main all.exe : all.c ; + diff --git a/winsup/mingw/samples/fmode/readme.txt b/winsup/mingw/samples/fmode/readme.txt index 873b853d3..b865bfd4e 100644 --- a/winsup/mingw/samples/fmode/readme.txt +++ b/winsup/mingw/samples/fmode/readme.txt @@ -1,5 +1,5 @@ -
-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.
-
+ +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 index f19e7e0ec..b0488b2ea 100644 --- a/winsup/mingw/samples/fmode/test.c +++ b/winsup/mingw/samples/fmode/test.c @@ -1,31 +1,31 @@ -/*
- * 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 <fcntl.h> /* Required to get _fmode and _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);
-}
-
+/* + * 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 <fcntl.h> /* Required to get _fmode and _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); +} + |