13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

See AlsoExampleThe two forms of the command differ only in the level of verbosity:OPEN "myfile.dta" FOR OUTPUT AS 11has the same effect as:OPEN "0" ,11, "myfile.dta"OPEN ErrorsAttempting to OPEN a file for INPUT that doesn't exist causesrun-time error 53, File Not Found. If you try to OPEN a nonexistentfHe for OUTPUT, APPEND, random access, or BINARYoperations,then it is created.OPEN COM1 This program is divided into five procedures. The1 difference between each procedure is the modeI.- in whi ch the fi 1 e is opened and the way the1 data in the file is manipulated.DEF FN PForKey$(Msg$)PRINT Msg$, "Press Bny key to continue ••• "WHILE NOT INSTAT : WENDFN PForKey$ = INKEY$END DEF 1 end procedure PForKeySUB Sequential Output1 The file is opened for sequential1 output and some data is written to it.KeyP$ = FNPForKey$("Now for some sequential output")1 open a sequential file for outputOPEN "OPEN.DTA" FOR OUTPUT AS 11Integer% = 12345TempStr$ = "History is made at night."1 write the data to the sequential fileWRITE' l,TempStr$, Integer% * 2, TempStr$, Integer% \ 2CLOSE 1 1 close the fileEND SUB 1 end procedure SequentialOutputSUB SequentialAppend1 The file is opened for sequential1 output. However, the data in this case1 is added to the end of the file.KeyP$ = FNPForKey$("Now to append some more stuff")1 open a sequential file to append data to itOPEN "OPEN.DTA" FOR APPEND AS Ii<strong>Turbo</strong> <strong>Basic</strong> Reference Directory 283

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!