home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
013
/
bdem22.zip
/
BDEMO013.TXT
< prev
next >
Wrap
Text File
|
1994-10-27
|
2KB
|
48 lines
BUILDER TEXT FILE FUNCTIONS
No Matter What System I Am Writing, It ALWAYS Seems I Need to Read or
Write CR/LF Delimited Text Files. So..Included in the Builder Library
are Four Functions That Allow You to Have FULL Access to Any CR/LF
Delimited Text File.
For Example The Following Code Sample is All That is Required to Read and
Display Your AUTOEXEC.BAT:
PROCEDURE Main()
LOCAL nHandle, cRec
nHandle := FOPEN( "C:\AUTOEXEC.BAT" ) // Low Level Open
// Test for Open Error
IF FERROR() <> 0
MsgBox( { "DOS ERROR " + ALLTRIM( STR( FERROR() ) ),
"Opening C:\AUTOEXEC.BAT" } )
RETURN
ENDIF
FEof(.f.) // Initialize End of File Test to False
// Read AUTOEXEC.BAT Records and Display Until End of File
DO WHILE !FEof()
cRec := FGets( nHandle ) // Read the record
? cRec
ENDDO
// Close the File
FCLOSE( nHandle )
RETURN
That's All There is To It! And With the Introduction in Builder v2.0 of
the fGetsR() Function, Which Reads Backwards, You Can Easily Create
Routines Like the Builder TextView() Function.
Note That the Builder TextView() Function is NOT Mouse Aware! It is One
of the Few Functions that is Not. This is Because the Mouse Pads for This
Function Should Be on the Screen Borders, and the TextView() Function Does
NOT Display Screen Borders! If You Want Your TextView()'s to Be Mouse
Aware, See the Sample "Hand Coded Section" When (If?) You Examine this
Demo Progam Using Builder Called "Hand021()".
** End of File