[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _fsWrite()
 Write a file
------------------------------------------------------------------------------
 C Prototype

     #include "filesys.api"
     USHORT _fsWrite(
                          FHANDLE hFileHandle,
                          BYTEP fpBuff,
                          USHORT uiCount
                       )

 Arguments

     hFileHandle is a valid DOS reference to the file to be written.

     fpBuff is a pointer to an allocated memory buffer.

     uiCount is the number of bytes to write to the file.

 Returns

     _fsWrite() returns the number of bytes written to the file.

 Description

     This function attempts to write uiCount bytes from the memory buffer
     fpBuff to the file specified by hFileHandle.  It is equivalent to the
     CA-Clipper function FWRITE().

     This function returns the number of bytes actually written.  If this
     return value is not equal to uiCount, use _fsError() to determine the
     nature of the error.

 Examples

     .  The following code fragment illustrates the use of _fsWrite().
        Note that error handling should be performed at each step.  Refer to
        the "Error System API Reference" chapter of this guide for details on
        communicating with the CA-Clipper Error system:

        #include "filesys.api"

        FHANDLE hFile;
        BYTEP fpBuff[15];

        hFile = _fsOpen( "Foo", FO_READWRITE | FO_EXCLUSIVE );

        // Check for an open error before using the file
        if (! _fsError() )
        {
           // Seek to EOF
           _fsSeek( hFile, 0, FS_END );

           _fsWrite( hFile, fpBuff, 15 );

           _fsClose( hFile );
        }

 Files  Library is CLIPPER.LIB, header file is Filesys.api.


See Also: _fsClose() _fsCreate() _fsError() _fsOpen()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson