#fclose()

DESCRIPTION
    close an open file, returning TRUE if successful, and ERR if unsuccessful
SYNOPSIS
    #fclose(F)
ARGUMENTS
    F - a filehandle (all caps)
EXAMPLES
outputfile(C, F)        // send all output from file (F) to communications
                        // channel (C)
                        // (C) is the comm channel (e.g., mail, syslog, print)
                        // (F) is the file (e.g., "=crontabs/$name")
                        // sample use:  =outputfile(mail, "=crontabs/$name")
                        if #fopen(OUTPUTFILE, (F), "r")
                                while #read(OUTPUTFILE) > 0
                                        output (C) $rdlin
                                endwhile
                                do #fclose(OUTPUTFILE)
                        fi
        begin
                // record all accounts in passwd file in #passwd[] array
                if #fopen(PASSWD, "/etc/passwd", "r") != #err()
                        while #read(PASSWD) > 0
                                do #split($p, $rdlin, ":")
                                if $p[1] eq "+"
                                        cont
                                fi
                                =incr(#passwd[=strip($p[1],"+")])
                        endwhile
                        do #fclose(PASSWD)
                else
                        output mail "can't open /etc/passwd for reading!"
                        quit
                endif
SEE ALSO
    #fopen()
    #popen()
    #pclose()
    #read()
    #write()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
Learn about
the outline of
Pikt scripts