|
|
| version 1.2, 2003/06/17 04:26:45 | version 1.3, 2004/06/08 00:45:00 |
|---|---|
| Line 35 | Line 35 |
| .\" | .\" |
| .\" @(#)fopen.3 8.1 (Berkeley) 6/4/93 | .\" @(#)fopen.3 8.1 (Berkeley) 6/4/93 |
| .\" $FreeBSD: src/lib/libc/stdio/fopen.3,v 1.7.2.6 2001/12/14 18:33:57 ru Exp $ | .\" $FreeBSD: src/lib/libc/stdio/fopen.3,v 1.7.2.6 2001/12/14 18:33:57 ru Exp $ |
| .\" $DragonFly: src/lib/libc/stdio/fopen.3,v 1.1 2003/06/16 04:33:23 dillon Exp $ | .\" $DragonFly$ |
| .\" | .\" |
| .Dd June 4, 1993 | .Dd June 08, 2004 |
| .Dt FOPEN 3 | .Dt FOPEN 3 |
| .Os | .Os |
| .Sh NAME | .Sh NAME |
| Line 138 The | Line 138 The |
| .Fn fdopen | .Fn fdopen |
| function associates a stream with the existing file descriptor, | function associates a stream with the existing file descriptor, |
| .Fa fildes . | .Fa fildes . |
| The | The mode |
| .Fa mode | |
| of the stream must be compatible with the mode of the file descriptor. | of the stream must be compatible with the mode of the file descriptor. |
| When the stream is closed via | When the stream is closed via |
| .Xr fclose 3 , | .Xr fclose 3 , |
| Line 160 The | Line 159 The |
| argument is used just as in the | argument is used just as in the |
| .Fn fopen | .Fn fopen |
| function. | function. |
| .Pp | |
| If the | |
| .Fa path | |
| argument is | |
| .Dv NULL , | |
| .Fn freopen | |
| attempts to re-open the file associated with | |
| .Fa stream | |
| with a new mode. | |
| The new mode must be compatible with the mode that the stream was originally | |
| opened with: | |
| .Bl -bullet -offset indent | |
| .It | |
| Streams originally opened with mode | |
| .Dq Li r | |
| can only be reopened with that same mode. | |
| .It | |
| Streams originally opened with mode | |
| .Dq Li a | |
| can be reopened with the same mode, or mode | |
| .Dq Li w . | |
| .It | |
| Streams originally opened with mode | |
| .Dq Li w | |
| can be reopened with the same mode, or mode | |
| .Dq Li a . | |
| .It | |
| Streams originally opened with mode | |
| .Dq Li r+ , | |
| .Dq Li w+ , | |
| or | |
| .Dq Li a+ | |
| can be reopened with any mode. | |
| .El | |
| .Pp | |
| The primary use of the | The primary use of the |
| .Fn freopen | .Fn freopen |
| function | function |
| is to change the file associated with a | is to change the file associated with a |
| standard text stream | standard text stream |
| .Pf ( Em stderr , | .Dv ( stderr , stdin , |
| .Em stdin , | |
| or | or |
| .Em stdout ) . | .Dv stdout ) . |
| .Sh RETURN VALUES | .Sh RETURN VALUES |
| Upon successful completion | Upon successful completion |
| .Fn fopen , | .Fn fopen , |
| Line 188 is set to indicate the error. | Line 221 is set to indicate the error. |
| .It Bq Er EINVAL | .It Bq Er EINVAL |
| The | The |
| .Fa mode | .Fa mode |
| provided to | argument |
| to | |
| .Fn fopen , | .Fn fopen , |
| .Fn fdopen , | .Fn fdopen , |
| or | or |