FIO.Create

Previous  Next

 

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

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

 


 

Creates a new text file.  You can use the second parameter to override the default which is create a file in text mode.  You can use the following:

 

"wt"   - Create an empty file in text mode

"at"   - Open an existing file and append to end of file in text mode

"w+t"  - Opens an empty file for both reading and writing in text mode

"wb"   - Create an empty file in binary mode

"ab"   - Open an existing file and append to end of file in binary mode

"w+b"  - Opens 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