77f671d36c10a4c830d0a1c590746f8429c6d5ff
[pspp] / doc / posix-functions / fopen.texi
1 @node fopen
2 @section @code{fopen}
3 @findex fopen
4
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fopen.html}
6
7 Gnulib module: fopen
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 This function does not fail when the file name argument ends in a slash
13 and (without the slash) names a nonexistent file or a file that is not a
14 directory, on some platforms:
15 HP-UX 11.00, AIX 7.1, Solaris 9, Irix 5.3.
16 @item
17 On Windows platforms (excluding Cygwin), this function does usually not
18 recognize the @file{/dev/null} filename.
19 @end itemize
20
21 Portability problems not fixed by Gnulib:
22 @itemize
23 @item
24 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
25 upon failure.
26 @item
27 On Windows, this function returns a file stream in ``text'' mode by default;
28 this means that it translates @code{'\n'} to CR/LF by default.  Use the
29 @code{"b"} flag if you need reliable binary I/O.
30 @item
31 On platforms where @code{off_t} is a 32-bit type, @code{fopen} may not work
32 correctly with files larger than 2 GB.  The fix is to use the
33 @code{AC_SYS_LARGEFILE} macro.
34 @item
35 On Windows platforms (excluding Cygwin), this function fails to open
36 directories for reading.  Such streams have implementation-defined
37 semantics on other platforms.  To avoid directory streams with a
38 consistent error message, use @code{fstat} after @code{open} and
39 @code{fdopen}, rather than @code{fopen} and @code{fileno}.
40 @end itemize