Description
exists()
checks if a file with the name exists already.
Syntax
exists( filename );
Parameters
char *filename – pointer a zero-terminated char array holding the file name
Returns
bool:
– true if a file with the name exists
– false if no file with this name exists
Example Code
#include "SerialFlash.h"
void setup()
{
while(!Serial);
SerialFlash.begin();
if( SerialFlash.exists("myFile.txt") )
Serial.println("File exists");
else
Serial.println("file does not exist");
}
void loop ()
{ }
Notes and Warnings
—
See also
GitHub – PaulStoffregen/SerialFlash – org. code this library is based on
c_str() – function to create a 0-terminated char array from a String
bool() – check the existence of a file by opening it and using bool() operator on it, alternatively