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.

Every file opened in BINARY mode has an associated position indicator thatpoints to the place in the file that will be read or written to next. Use the SEEKstatement to set the position indicator and the LOC function to read it.Binary files are accessed in the following way:1. OPEN the file in BINARY mode. You need not specify whether you're readingor writing-you can do either or both.2. To read the file, use SEEK to position the file pointer at the byte you want toread. Then use GET$ to read a specifIed number of characters (from 1 to32,767) into a string variable.3. To write to the file, load a string variable with the information to be written.Then use PUT$ to specify the string data and the point in the file to which itshould be written.4. When finished, CLOSE the file.Following are the <strong>Turbo</strong> <strong>Basic</strong> statements and functions that control binary filereading and writing:S tatement/FunctionCLOSEGET$LOCLOFOPENPUT$SEEKOperationCloses the fileReads the specified number of bytes starting at seek positionDetermines the seek position in the fileReturns the length of fileOpens the file and declares it as binaryWrites the specified number of bytes starting at seek positionMoves the position indicator108<strong>Turbo</strong> <strong>Basic</strong> Owner's Handbook

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

Saved successfully!

Ooh no, something went wrong!