2 freopen - close (if necessary) and reopen a filestream
5 freopen(fs, mode [,filename])
8 fs open or closed file stream
9 mode one of the strings "r", "w", "a", "r+", "w+, "a+"
12 return null or error value
15 With two arguments, this function closes the file stream fs and
16 attempts to reopen it with the specified mode. A non-null value
17 is returned only if the attempt fails.
19 With three arguments, fs, if open, is closed, and an attempt is made to
20 open the file with the specified name and assign it to the stream
21 fs. A non-null value is returned only if the attempt fails.
25 ; f = fopen("/tmp/junk", "w")
26 ; fputs(f, "Leonard Euler")
30 ; !chmod u-w /tmp/junk
41 errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
42 fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
44 ## Copyright (C) 1999-2006 Landon Curt Noll
46 ## Calc is open software; you can redistribute it and/or modify it under
47 ## the terms of the version 2.1 of the GNU Lesser General Public License
48 ## as published by the Free Software Foundation.
50 ## Calc is distributed in the hope that it will be useful, but WITHOUT
51 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
52 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
53 ## Public License for more details.
55 ## A copy of version 2.1 of the GNU Lesser General Public License is
56 ## distributed with calc under the filename COPYING-LGPL. You should have
57 ## received a copy with calc; if not, write to Free Software Foundation, Inc.
58 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
60 ## @(#) $Revision: 30.1 $
61 ## @(#) $Id: freopen,v 30.1 2007/03/16 11:10:42 chongo Exp $
62 ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freopen,v $
64 ## Under source code control: 1996/04/30 03:05:18
65 ## File existed as early as: 1996
67 ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
68 ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/