[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| F_GETLN() |------------------------------------------------+#############
#| +-----------+ Reads a line of text from the file file_stream |#############
#+--------------------------------------------------------------+#############
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE fileio.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |-------------------------------------------+####################
#| FUNCTION LOGICAL f_getln PROTOTYPE |####################
#| PARAMETERS FILE file_stream, CHAR input_line |####################
#+-------------------------------------------------------+####################
##############################################################################
##############################################################################
#####+---| Description |-------------------------------------------------+####
#####| The f_getln() function reads a line of text from the file_stream |####
#####| file and places the line in input_line. A carriage-return and/or |####
#####| line-feed character terminates the read. If file_stream is at |####
#####| end of file, a NULL string is returned. |####
#####| ----------------------------------------------------------------- |####
#####| input_line variable must be big enough to receive the input text, |####
#####| as f_getln() does not verify the size of the destination. |####
#####| ----------------------------------------------------------------- |####
#####| The file_stream must have been opened in &F_READ mode. |####
#####+-------------------------------------------------------------------+####
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Find a character string within a file. |#########
#########| |#########
#########| VARDEF |#########
#########| FILE srch |#########
#########| CHAR input_buffer |#########
#########| ENDDEF |#########
#########| |#########
#########| {...} |#########
#########| search = "find this" |#########
#########| IF .NOT. f_open( srch, "search.txt", &F_READ ) |#########
#########| ? "Unable to open search.txt" |#########
#########| QUIT |#########
#########| ENDIF |#########
#########| DO WHILE .NOT. f_eof( srch ) |#########
#########| f_getln( srch, input_buffer ) |#########
#########| IF search $ lower( input_buffer ) |#########
#########| ? "Found! .. " |#########
#########| EXIT |#########
#########| ENDIF |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Remove a driver from the config.sys file. |#########
#########| |#########
#########| PROCEDURE remove_driver |#########
#########| VARDEF |#########
#########| FILE in_file |#########
#########| FILE out_file |#########
#########| CHAR(255) input_line |#########
#########| ENDDEF |#########
#########| |#########
#########| DO f_open WITH in_file, "\config.sys", &F_READ |#########
#########| DO f_open WITH out_file, "\config.tmp", &F_CREATE |#########
#########| DO WHILE .NOT. f_eof( c_file ) |#########
#########| DO f_getln WITH in_file, input_line |#########
#########| IF "hdskv1.sys" $ input_line |#########
#########| LOOP |#########
#########| ENDIF |#########
#########| |#########
#########| DO f_putln WITH out_file, input line |#########
#########| ENDDO |#########
#########| DO f_close WITH out_file |#########
#########| DO f_close WITH in_file |#########
#########| ERASE "\config.sys" |#########
#########| RENAME "\config.tmp" TO "\config.sys" |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
f_close
f_eof()
f_flush
f_open()
f_put
f_putln
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson