#write()

DESCRIPTION
    write a string to the file handle associated with some open file or process,
    returning the number of characters written, else ERR on error
SYNOPSIS
    #write(F,s)
ARGUMENTS
    F - a filehandle (or process handle) (all caps)
    s - a string, or string expression
EXAMPLES
        begin
                if #fopen(MMUSERS, "=mmusers\.tmp", "w") == #err()
                        output mail "Unable to open =mmusers\.tmp for writing!"
                        quit
                endif
                set $listmembers = "=mmbindir/list_members"

        rule
                if #popen(ADDRS, "$listmembers $inlin", "r") != #err()
                        while #read(ADDRS) > 0
                                do #write(MMUSERS, "$inlin:$rdlin")
                        endwhile
                        do #pclose(ADDRS)
                else
                        output mail "Unable to open '$listmembers $inlin' for reading!"
                        quit
                endif
output_other_mail(P, S, R, L)   // output conditional mail to addressee(s)
                                // beyond those specified in the alert
                                // mailcmd; we don't #pclose() the (P)
                                // proc handle at the end, instead letting
                                // pikt do it, enabling us to make this a
                                // a one-liner macro
                                // (P) is the proc handle name (e.g., MAIL)
                                // (S) is the subject (e.g., 'check this out')
                                // (R) is the recipient (e.g., osterlund\@handel)
                                // (L) is the line (e.g., $inline)

                if ! #defined(#isopen(P))
                        set #isopen(P) = #false()
                fi
                if ! #isopen(P)
                        if #popen((P), "=mailx -a 'From: piktadmin' -s (S) (R)", "w") != #err()
                                set #isopen(P) = #true()
                        else
                                output mail "\#popen() failure for: =mailx -s (S) (R)"
                                quit
                        fi
                fi
                do #write((P), (L))
SEE ALSO
    #fopen()
    #fclose()
    #popen()
    #pclose()
    #read()

    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
View sample
script scheduling
macros