modified: diffout.py
[GalaxyCodeBases.git] / c_cpp / etc / calc / help / fclose
blob64b41fbc0f62d06c4406e8231961349a2dd192b6
1 NAME
2     fclose - close a file
4 SYNOPSIS
5     fclose(fd)
7 TYPES
8     fd          file
10     return      nul or int
12 DESCRIPTION
13     This function closes the open file associated with the descriptor fd.
14     When this is done, the file value associated with the file remains
15     a file value, but appears 'closed', and cannot be used in further
16     file-related calls (except fclose) without causing errors.  This same
17     action occurs to all copies of the file value.  You do not need to
18     explicitly close all the copies of a file value.
20     Standard input, standard output and standard error are always opened
21     and cannot be closed.
23     The truth value of a closed file is FALSE.
25     The fclose function returns the numeric value of errno if
26     there had been an error using the file, or the null value if
27     there was no error.
29     Closing a closed file is permitted.  Fclose returns null in
30     this case.
32 EXAMPLE
33     ; fd = fopen("/etc/motd", "r")
34     ; if (fd) print "file is open";
35     file is open
37     ; err = fclose(fd);
38     ; if (isnull(err)) print "close successful"; else strerror(err);
39     close successful
41     ; if (!fd) print "file is closed";
42     file is closed
44 LIMITS
45     fd != files(0) && fd != files(1) && fd != files(2)
47 LINK LIBRARY
48     none
50 SEE ALSO
51     errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
52     fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
54 ## Copyright (C) 1999-2006  Landon Curt Noll
56 ## Calc is open software; you can redistribute it and/or modify it under
57 ## the terms of the version 2.1 of the GNU Lesser General Public License
58 ## as published by the Free Software Foundation.
60 ## Calc is distributed in the hope that it will be useful, but WITHOUT
61 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
62 ## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
63 ## Public License for more details.
65 ## A copy of version 2.1 of the GNU Lesser General Public License is
66 ## distributed with calc under the filename COPYING-LGPL.  You should have
67 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
68 ## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
70 ## @(#) $Revision: 30.1 $
71 ## @(#) $Id: fclose,v 30.1 2007/03/16 11:10:42 chongo Exp $
72 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fclose,v $
74 ## Under source code control:   1994/10/27 03:04:16
75 ## File existed as early as:    1994
77 ## chongo <was here> /\oo/\     http://www.isthe.com/chongo/
78 ## Share and enjoy!  :-)        http://www.isthe.com/chongo/tech/comp/calc/