[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FWRITE()

    FWRITE() writes a buffer variable to a DOS file.

Syntax

    FWRITE(<expN1>,<memvarC>[,<expN2>])

Argument

    <expN1> is the file handle obtained previously from FOPEN(), FCREATE(),
    or predefined by DOS.

    <memvarC> is the name of a pre-existing character memory variable to
    use as an output buffer.

    <expN2> indicates the number of bytes to write from the buffer variable
    to the file beginning with the current file pointer location.  If this
    argument is omitted, the entire contents of the buffer variable are
    written.

Returns

    A numeric value.

    FWRITE() returns the number of bytes successfully written.  If the
    return value is 0, the disk is full or an error has occurred.  Check
    FERROR() for the precise DOS error designation.  Note that the value
    returned by a successful FWRITE() should be equal to <expN2>.

Example


    buffer = SPACE(512)                            
    handle = FOPEN("Temp.txt")                     
    *                                              
    outfile = FCREATE("Newfile.txt")               
    IF FERROR() <> 0                               
       ? "Cannot create file, DOS error ", FERROR()
       RETURN                                      
    ENDIF                                          
    *                                              
    FREAD(infile, @buffer, 512)                    
    IF FERROR() <> 0                               
       ? "Cannot read file, DOS error ", FERROR()  
       RETURN                                      
    ENDIF                                          
    *                                              
    FWRITE(outfile, buffer, 512)                   
    IF FERROR() <> 0                               
       ? "Cannot write file, DOS error ", FERROR() 
    ENDIF                                          

WARNING: This function allows low level access to DOS files & devices.
             They should be used with extreme care and require a thorough
             knowledge of the operating system.

See Also: FCLOSE FCREATE FERROR FOPEN FREADSTR FSEEK
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson