Simon Ford / Mbed 2 deprecated fgets

Dependencies:   mbed

main.cpp

Committer:
simon
Date:
2010-01-03
Revision:
0:a6eefc8c816e

File content as of revision 0:a6eefc8c816e:

#include "mbed.h"

DigitalOut myled(LED1);
LocalFileSystem local("local");

int main() {
    FILE *fp = fopen("/local/lines.txt", "r");
    
    if(!fp) { 
        error("Could not open file!\n");
    }
    
    char buffer[128];
    while(fgets(buffer, 128, fp)) {
        printf("Line: %s\n", buffer);
        wait(1);
    }

    fclose(fp);
    
    printf("Done\n");
}