File_Append()

… visits
Parent Previous Next

Syntax

File_Append(pFileName), Byte

Overview

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

Return status

Value

Meaning

cErrOK

Success.

cErrNotFound

File not found.

cErrDiskFull

Disk is full.

cErrInUse

File is already open and in use.

cErrRWError

Read/write error.

Open a File for Appending Data

This procedure opens an existing file for writing, specifically appending data to the end of the file. The maximum name length is 12 characters, including the file extension.

Example

File_Append("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

File_TimeModified(5,11,24, 12,39,45)                                                        'Set modified property

While File_Append("append.log") <> cErrOK : Wend                                            'Open file append.log to edit data

TftPrintSndString("Append append.log OK",1,0,2,1,GREEN,BLACK,0)                             'Confirm append.log is open

sString = " world!"                                                                         'Load string with data to be written

For bCounter = 0 To 12

If sString[bCounter] = 0 Then Break                                                     'break if end of string

File_WriteByte(sString[bCounter])                                                       'write data to append.Log

Next

If File_Flush() = 1 Then

TftPrintSndString("Flush append.Log OK",1,0,3,1,GREEN,BLACK,0)                          'confirm flush ok and good to remove card

Else

TftPrintSndString("Flush append.Log NO",1,0,3,1,GREEN,BLACK,0)                          'flush not ok and not good to remove card

EndIf

File_Append()File_Append()File_Append()

Created with the Personal Edition of HelpNDoc: Transform your help documentation into a stunning website