File_Open()

… visits
Parent Previous Next

Syntax

File_Open(pFileName), Byte

Overview

pFileName: The name of the file to open for reading (maximum length 12 characters, including dot and extension).

Return status

Value

Meaning

cErrOK

Success.

cErrNotFound

File not found.

cErrInUse

File number is already in use.

cErrRWError

Read/write error.

Open a File for Reading

This procedure opens an existing file for reading only. The maximum name length is 12 characters, including the file extension.

Example

File_Open("MyFile.txt")

Notes

TftSetUp(0, 0)                                                                                 'Set screen

TftResetScreen(BLACK)                                                                       'Reset screen

TftSetSndFont(0,0)                                                                          'Set Font0

While File_Init() <> cErrOK : Wend                                                          'Initialize SD Card

TftPrintSndString("Sd Initialization OK",1,0,0,1,GREEN,BLACK,0)                             'Confirm Initialize SD Card

While File_Open("Open.txt") <> cErrOK : Wend                                                'Open file Open.txt to edit data

TftPrintSndString("Open Open.txt OK",1,0,2,1,GREEN,BLACK,0)                                 'Confirm Open.txt is open

bCounter = 0                                                                                'Print position counter

Do

TftPrintSndChar(File_ReadByte(),1,bCounter,3,1,GREEN,BLACK,0)                           'Print data as text

If File_EOF() = 1 Then Break                                                            'Loop till end of file

Inc bCounter

Loop

File_Close()                                                                                'close file

TftPrintSndString("Close Open.txt OK",1,0,4,1,GREEN,BLACK,0)                                'Confirm close file

File_Open()File_Open()

Created with the Personal Edition of HelpNDoc: Revolutionize your documentation process with HelpNDoc's online capabilities