FIO.Open

Previous  Next

 

fileid = FIO.Open( file-name AS STRING,

                  [mode      AS STRING="rt"] ) AS INTEGER

 


 

Open an existing text file and returns the file ID as an INTEGER

 

"rt"   - Opens an existing file for reading in text mode

"r+t"  - Open an existing file for both reading and writing in text mode

"a+t"  - Opens an existing or crates an empty file for both reading and writing in text mode

"rb"   - Opens an existing file for reading in binary mode

"r+b"  - Open an existing file for both reading and writing in binary mode

"a+b"  - Opens an existing or crates an empty file for both reading and writing in binary mode

 

Example:

 

$LIBRARY "MyBASIC2_ExtLib.dll"

 

i = FIO.Create( "d:\fff.txt" )

 

IF i > -1 THEN

  PRINT FIO.Puts( i, "Kalle Anka was here today" ),

  FIO.Close(i)

ENDIF

 

i = FIO.Open("d:\kalle.txt")

 

IF i > -1 THEN

  WHILE FIO.Eof(i) = 0

     str$ = FIO.Gets( i )

     PRINT str$

  WEND

  FIO.Close(i)

ENDIF

 

END