![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
udenokai sample
Revision 1:4b0cd1f19fd8, committed 2011-06-10
- Comitter:
- marishi
- Date:
- Fri Jun 10 16:40:12 2011 +0000
- Parent:
- 0:2acd856cf56b
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2acd856cf56b -r 4b0cd1f19fd8 main.cpp --- a/main.cpp Fri Jun 10 16:06:05 2011 +0000 +++ b/main.cpp Fri Jun 10 16:40:12 2011 +0000 @@ -1,27 +1,21 @@ //udenokai sample #include "mbed.h" -#include "TextLCD.h" LocalFileSystem local("local"); -TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7 Serial pc(USBTX, USBRX); // tx, rx const unsigned int MAX_LEN = 256; int main() { - FILE *fp; - if( NULL == (fp = fopen("/local/test.txt","r"))){ + FILE *fp = fopen("/local/test.txt","r"); + if(NULL == fp){ pc.printf("open error"); } + char str[MAX_LEN]; - char str[MAX_LEN]; - while( NULL != fgets( str , MAX_LEN-1 , fp ) ) - //while( EOF != fscanf(fp,"%s",str) ) - { - lcd.cls(); - lcd.printf(str); - pc.getc(); - } + fgets( str , MAX_LEN-1 , fp ); + pc.printf(str); + fclose(fp); } \ No newline at end of file