Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - pickfile() read a file into a string list
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
pickfile() Read a file into a string list
------------------------------------------------------------------------------
Declaration
pick.hdr
Syntax
func logical pickfile extern
param value _SLIST pList, ;
const char cFile, ;
value logical lReplaceTab
Arguments
pList is the list to fill with file data.
cFile is the name of the file to read in.
lReplaceTab indicates if tab characters in the file should be
replaced by spaces.
Return
A logical indicating the success of operation.
Description
The pickfile() function fills a string list with lines of the given text
file. The function stops reading the file if free memory falls below
20 Kbytes. The return value is .f. if the file could not be opened,
or read entirely.
The lReplaceTab parameter controls the replacement of tabs in the text
read from the file. Set this parameter to .t. if the text lines will
be displayed on the screen in a given width.
Example
#define EXAMPLE_LIST
#include example.hdr
proc Test_pickfile
vardef
_SLIST pList
uint n
enddef
pList := pickinit() // get a pick list
if pickfile( pList, "c:\autoexec.bat", .t. ) // read in a file
for n := 1 to pickcount( pList )
? lower( pickstr( pList, n ) ) // display modified lines
next
else
? "File not found"
endif
pickclear( pList ) // clear pick list
endproc
proc main
Test_pickfile()
endproc
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson