Syntax
LFile open(
    const char * filename, 
    uint8_t mode = FILE_READ
);
ContentsIndex
PreviousUpNext
LDrive::open Method
LDrive Class
Syntax
LFile open(
    const char * filename, 
    uint8_t mode = FILE_READ
);
Description

Opens a file (or folder). The following happens when the file path does not exist: - If FILE_WRITE mode is provided, an empty file is created; - If FILE_READ mode is provided, it returns Failed. 

  • FILE_READ: It can read from the beginning of file. It cannot write.
  • FILE_WRITE: It can read and write, starting from the end of file in order to append the written data.
 

Parameters
Parameters 
Description 
const char * filename 
[IN] The file to open. 
uint8_t mode = FILE_READ 
[IN] The mode of opening, FILE_READ by default if not specified. 
Returns

An LFile object to represent the file (or folder). 

An empty LFile object, if the open file fails. An empty LFile object can be evaluated as false and you can use if (f) to test the result.

File

LStorage.h

Class