1*48352Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 246068Sbostic.\" All rights reserved. 320310Smckusick.\" 446068Sbostic.\" This code is derived from software contributed to Berkeley by 546068Sbostic.\" Chris Torek. 646068Sbostic.\" %sccs.include.redist.man% 746068Sbostic.\" 8*48352Scael.\" @(#)fclose.3 6.6 (Berkeley) 04/19/91 946068Sbostic.\" 10*48352Scael.Dd 11*48352Scael.Dt FCLOSE 3 12*48352Scael.Os 13*48352Scael.Sh NAME 14*48352Scael.Nm fclose 15*48352Scael.Nd close a stream 16*48352Scael.Sh SYNOPSIS 17*48352Scael.Fd #include <stdio.h> 18*48352Scael.Ft int 19*48352Scael.Fn fclose "FILE *stream" 20*48352Scael.Sh DESCRIPTION 21*48352ScaelThe 22*48352Scael.Fn fclose 23*48352Scaelfunction 2446068Sbosticdissociates the named 25*48352Scael.Fa stream 2646068Sbosticfrom its underlying file or set of functions. 2746068SbosticIf the stream was being used for output, any buffered data is written 2846068Sbosticfirst, using 29*48352Scael.Xr fflush 3 . 30*48352Scael.Sh RETURN VALUES 3146068SbosticUpon successful completion 0 is returned. 3246068SbosticOtherwise, 33*48352Scael.Dv EOF 3446068Sbosticis returned and the global variable 35*48352Scael.Va errno 3646068Sbosticis set to indicate the error. 37*48352ScaelIn either case no further access to the stream is possible. 38*48352Scael.Sh ERRORS 39*48352Scael.Bl -tag -width [EBADF] 40*48352Scael.It Bq Er EBADF 41*48352ScaelThe argument 42*48352Scael.Fa stream 4346068Sbosticis not an open stream. 44*48352Scael.El 45*48352Scael.Pp 46*48352ScaelThe 47*48352Scael.Fn fclose 48*48352Scaelfunction 49*48352Scaelmay also fail and set 50*48352Scael.Va errno 5146068Sbosticfor any of the errors specified for the routines 52*48352Scael.Xr close 2 53*48352Scaelor 54*48352Scael.Xr fflush 3 . 55*48352Scael.Sh SEE ALSO 56*48352Scael.Xr close 2 , 57*48352Scael.Xr fflush 3 , 58*48352Scael.Xr fopen 3 , 59*48352Scael.Xr setbuf 3 60*48352Scael.Sh STANDARDS 61*48352ScaelThe 62*48352Scael.Fn fclose 63*48352Scaelfunction 64*48352Scaelconforms to 65*48352Scael.St -ansiC . 66