Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/samples/filehand/filehand.c')
-rw-r--r--winsup/mingw/samples/filehand/filehand.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/winsup/mingw/samples/filehand/filehand.c b/winsup/mingw/samples/filehand/filehand.c
index 24e048c52..2af69b371 100644
--- a/winsup/mingw/samples/filehand/filehand.c
+++ b/winsup/mingw/samples/filehand/filehand.c
@@ -1,57 +1,57 @@
-/*
- * An example showing how you can obtain the UNIX-ish file number from a
- * FILE* and in turn how you can get the Win32 HANDLE of the file from
- * the file number.
- *
- * This code is in the PUBLIC DOMAIN and has NO WARRANTY.
- *
- * Colin Peters <colin@fu.is.saga-u.ac.jp>
- */
-
-#include <stdio.h>
-#include <io.h>
-#include <windows.h>
-
-int
-main (int argc, char* argv[])
-{
- char* szFileName;
- FILE* fileIn;
- int fnIn;
- HANDLE hFileIn;
- char caBuf[81];
- int nRead;
-
- if (argc >= 2)
- {
- szFileName = argv[1];
- }
- else
- {
- szFileName = "junk.txt";
- }
-
- fileIn = fopen (szFileName, "r");
-
- if (!fileIn)
- {
- printf ("Could not open %s for reading\n", szFileName);
- exit(1);
- }
-
- fnIn = fileno (fileIn);
- hFileIn = (HANDLE) _get_osfhandle (fnIn);
-
- printf ("OS file handle %d\n", (int) hFileIn);
-
- ReadFile (hFileIn, caBuf, 80, &nRead, NULL);
-
- printf ("Read %d bytes using ReadFile.\n", nRead);
-
- caBuf[nRead] = '\0';
-
- printf ("\"%s\"\n", caBuf);
-
- fclose (fileIn);
-}
-
+/*
+ * An example showing how you can obtain the UNIX-ish file number from a
+ * FILE* and in turn how you can get the Win32 HANDLE of the file from
+ * the file number.
+ *
+ * This code is in the PUBLIC DOMAIN and has NO WARRANTY.
+ *
+ * Colin Peters <colin@fu.is.saga-u.ac.jp>
+ */
+
+#include <stdio.h>
+#include <io.h>
+#include <windows.h>
+
+int
+main (int argc, char* argv[])
+{
+ char* szFileName;
+ FILE* fileIn;
+ int fnIn;
+ HANDLE hFileIn;
+ char caBuf[81];
+ int nRead;
+
+ if (argc >= 2)
+ {
+ szFileName = argv[1];
+ }
+ else
+ {
+ szFileName = "junk.txt";
+ }
+
+ fileIn = fopen (szFileName, "r");
+
+ if (!fileIn)
+ {
+ printf ("Could not open %s for reading\n", szFileName);
+ exit(1);
+ }
+
+ fnIn = fileno (fileIn);
+ hFileIn = (HANDLE) _get_osfhandle (fnIn);
+
+ printf ("OS file handle %d\n", (int) hFileIn);
+
+ ReadFile (hFileIn, caBuf, 80, &nRead, NULL);
+
+ printf ("Read %d bytes using ReadFile.\n", nRead);
+
+ caBuf[nRead] = '\0';
+
+ printf ("\"%s\"\n", caBuf);
+
+ fclose (fileIn);
+}
+