LPC1768のfirmwareのrev違いによるlocal file systemの挙動の違い確認用サンプルプログラム

Dependencies:   mbed

main.cpp

Committer:
suupen
Date:
2013-10-10
Revision:
0:dd20e2c7a353

File content as of revision 0:dd20e2c7a353:

#include "mbed.h"
 
LocalFileSystem SeqFile("Local");
 
 Serial pc(USBTX, USBRX);
 
int main() {
    FILE    *fp;
    int     i   = 1;
 
    pc.printf( "\r\nSTART\r\n" );
    wait( 0.1 );
 
    while ( 1 ) {
        fp = fopen( "/Local/TEST.txt", "a" );
        if (!fp) {
            pc.printf( "error %d\r\n", i );
            exit( 1 );
        } else {
            fprintf(fp, "%d (%p)\r\n", i, fp);
            pc.printf( "%d (%p)\r\n", i, fp );
            fclose( fp );
#if defined(__MICROLIB) && defined(__ARMCC_VERSION) // with microlib and ARM compiler
            free(fp);
#endif
        }
        wait( 0.1 );
        i++;
    }
}