[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+------------+#############################################################
#+-| FB_WRITE() |---------------------------------------------------+#########
#| +------------+ Attempts to write number_of_bytes bytes to a file |#########
#+------------------------------------------------------------------+#########
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE fileio.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |-----------------------------------------+######################
#| FUNCTION UINT fb_write PROTOTYPE |######################
#| PARAMETERS VALUE UINT handle |######################
#| UNTYPED buffer, VALUE UINT number_of_bytes |######################
#+-----------------------------------------------------+######################
##############################################################################
##############################################################################
#########+---| Description |-----------------------------------------+########
#########| The fb_write() function attempts to write number_of_bytes |########
#########| bytes to the file specified by handle from the buffer |########
#########| trans_buffer. It returns the number of bytes actually |########
#########| transferred. If fb_write() returns a value different |########
#########| from the value specified in number_of_bytes, then the |########
#########| disk is full or there is a physical defect with the file. |########
#########| It is most likely that the disk is full. |########
#########| --------------------------------------------------------- |########
#########| The maximum value for number_of_bytes is 65535 or |########
#########| 0xffff. The buffer trans_buffer may represent any data |########
#########| type - CHAR, DBL, LOGICAL, etc.. For example, you may |########
#########| use fb_write() to write from a DBL array or a LOGICAL |########
#########| variable. |########
#########| --------------------------------------------------------- |########
#########| As data is transferred to handle DOS adjusts the read |########
#########| write pointer by number_of_bytes bytes. So, if |########
#########| fb_write() writes 20 bytes, the read write pointer of |########
#########| the file is adjusted by 20 bytes. Use fb_seek() to move |########
#########| the read write pointer. |########
#########| --------------------------------------------------------- |########
#########| The file must have been opened prior to the write unless |########
#########| the function call uses one of the predefined DOS file |########
#########| handles. DOS has five file handles that are predefined, |########
#########| that is, handles 0 through 4. These handles DO NOT need |########
#########| to be opened. By using DOS predefined handles, you can |########
#########| write DOS filters. |########
#########| --------------------------------------------------------- |########
#########| The header file fileio.hdr contains defines for the DOS |########
#########| file handles. |########
#########| refer to the table DOS HANDLES TABLE for more details. |########
#########+-----------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * write 55 bytes from a character string. |#########
#########| |#########
#########| num_trans = fb_write( f[z], char_string, 55 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * A "generic" write to file function. This function |#########
#########| * checks to see if the disk is full. |#########
#########| |#########
#########| FUNCTION UINT write_file |#########
#########| PARAMETERS VALUE UINT h, UNTYPED buffer, ; |#########
#########| VALUE UINT length |#########
#########| VARDEF |#########
#########| UINT trans |#########
#########| ENDDEF |#########
#########| |#########
#########| trans = fb_write( h, buffer, length ) |#########
#########| IF trans <> length |#########
#########| error_proc("Transfer error") |#########
#########| ENDIF |#########
#########| RETURN trans |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Write to the standard printer device. Use |#########
#########| * fb_write() to send a NULL character to a printer. |#########
#########| |#########
#########| byte_val = 0 |#########
#########| fb_write( &STD_PRN, byte_val, 1 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
fb_close
fb_eof()
fb_open()
fb_read()
fb_seek()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson