ESP8266_AT/YAT4LConf/xts_yat4l_dev_fs.h
/**
 * 
 * YAT4L FileSystem routines impl.
 * 
 * Xtase - fgalliat @Dec 2019
 */
YAT4L FileSystem routines impl.

fgalliat @Dec 2019
YAT4L FileSystem routines impl . fgalliat @Dec 2019
int yat4l_fs_readTextFile(char* fileName, char* dest, int maxLen) {
    if ( fileName == NULL || dest == NULL || maxLen < 0 ) {
        return -1;
    }
    memset(dest, 0x00, maxLen);
    if ( maxLen == 0 ) { return 0; }
    File f = SD.open( fileName, O_READ );
    if ( !f ) {
        return -1;
    }
    int cpt=0, ch;
    while(true) {
        ch = f.read();
        if ( ch == -1 ) { break; }
        dest[cpt] = ch;
        cpt++;
        if ( cpt >= maxLen ) { break; }
    }
    f.close();
return cpt;
}
int yat4l_fs_readTextFile ( char * fileName , char * dest , int maxLen ) { if ( fileName == NULL || dest == NULL || maxLen < 0 ) { return -1 ; } memset ( dest , 0x00 , maxLen ) ; if ( maxLen == 0 ) { return 0 ; } File f = SD . open ( fileName , O_READ ) ; if ( ! f ) { return -1 ; } int cpt = 0 , ch ; while ( true ) { ch = f . read ( ) ; if ( ch == -1 ) { break ; } dest [ cpt ] = ch ; cpt ++ ; if ( cpt >= maxLen ) { break ; } } f . close ( ) ; return cpt ; }
YAT4L FileSystem routines impl.
YAT4L FileSystem routines impl .