fgets
Published 03 Jan 2010, by
Simon Ford

No tags
« Back to documentation index
Show/hide line numbers
main.cpp Source File
main.cpp
00001 #include "mbed.h"
00002
00003 DigitalOut myled(LED1);
00004 LocalFileSystem local("local");
00005
00006 int main() {
00007 FILE *fp = fopen("/local/lines.txt", "r");
00008
00009 if(!fp) {
00010 error("Could not open file!\n");
00011 }
00012
00013 char buffer[128];
00014 while(fgets(buffer, 128, fp)) {
00015 printf("Line: %s\n", buffer);
00016 wait(1);
00017 }
00018
00019 fclose(fp);
00020
00021 printf("Done\n");
00022 }