1*61178Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61178Sbostic.\" The Regents of the University of California. All rights reserved. 320310Smckusick.\" 446068Sbostic.\" This code is derived from software contributed to Berkeley by 550290Sbostic.\" Chris Torek and the American National Standards Committee X3, 650290Sbostic.\" on Information Processing Systems. 750290Sbostic.\" 846068Sbostic.\" %sccs.include.redist.man% 946068Sbostic.\" 10*61178Sbostic.\" @(#)fclose.3 8.1 (Berkeley) 06/04/93 1146068Sbostic.\" 1248352Scael.Dd 1348352Scael.Dt FCLOSE 3 1448352Scael.Os 1548352Scael.Sh NAME 1648352Scael.Nm fclose 1748352Scael.Nd close a stream 1848352Scael.Sh SYNOPSIS 1948352Scael.Fd #include <stdio.h> 2048352Scael.Ft int 2148352Scael.Fn fclose "FILE *stream" 2248352Scael.Sh DESCRIPTION 2348352ScaelThe 2448352Scael.Fn fclose 2548352Scaelfunction 2646068Sbosticdissociates the named 2748352Scael.Fa stream 2846068Sbosticfrom its underlying file or set of functions. 2946068SbosticIf the stream was being used for output, any buffered data is written 3046068Sbosticfirst, using 3148352Scael.Xr fflush 3 . 3248352Scael.Sh RETURN VALUES 3346068SbosticUpon successful completion 0 is returned. 3446068SbosticOtherwise, 3548352Scael.Dv EOF 3646068Sbosticis returned and the global variable 3748352Scael.Va errno 3846068Sbosticis set to indicate the error. 3948352ScaelIn either case no further access to the stream is possible. 4048352Scael.Sh ERRORS 4148352Scael.Bl -tag -width [EBADF] 4248352Scael.It Bq Er EBADF 4348352ScaelThe argument 4448352Scael.Fa stream 4546068Sbosticis not an open stream. 4648352Scael.El 4748352Scael.Pp 4848352ScaelThe 4948352Scael.Fn fclose 5048352Scaelfunction 5148352Scaelmay also fail and set 5248352Scael.Va errno 5346068Sbosticfor any of the errors specified for the routines 5448352Scael.Xr close 2 5548352Scaelor 5648352Scael.Xr fflush 3 . 5748352Scael.Sh SEE ALSO 5848352Scael.Xr close 2 , 5948352Scael.Xr fflush 3 , 6048352Scael.Xr fopen 3 , 6148352Scael.Xr setbuf 3 6248352Scael.Sh STANDARDS 6348352ScaelThe 6448352Scael.Fn fclose 6548352Scaelfunction 6648352Scaelconforms to 6748352Scael.St -ansiC . 68