taichi yanagisawa
/
LocalFileSystem_Load
udenokai sample
main.cpp@1:4b0cd1f19fd8, 2011-06-10 (annotated)
- Committer:
- marishi
- Date:
- Fri Jun 10 16:40:12 2011 +0000
- Revision:
- 1:4b0cd1f19fd8
- Parent:
- 0:2acd856cf56b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marishi | 0:2acd856cf56b | 1 | //udenokai sample |
marishi | 0:2acd856cf56b | 2 | #include "mbed.h" |
marishi | 0:2acd856cf56b | 3 | |
marishi | 0:2acd856cf56b | 4 | LocalFileSystem local("local"); |
marishi | 0:2acd856cf56b | 5 | Serial pc(USBTX, USBRX); // tx, rx |
marishi | 0:2acd856cf56b | 6 | |
marishi | 0:2acd856cf56b | 7 | const unsigned int MAX_LEN = 256; |
marishi | 0:2acd856cf56b | 8 | |
marishi | 0:2acd856cf56b | 9 | int main() |
marishi | 0:2acd856cf56b | 10 | { |
marishi | 1:4b0cd1f19fd8 | 11 | FILE *fp = fopen("/local/test.txt","r"); |
marishi | 1:4b0cd1f19fd8 | 12 | if(NULL == fp){ |
marishi | 0:2acd856cf56b | 13 | pc.printf("open error"); |
marishi | 0:2acd856cf56b | 14 | } |
marishi | 1:4b0cd1f19fd8 | 15 | char str[MAX_LEN]; |
marishi | 0:2acd856cf56b | 16 | |
marishi | 1:4b0cd1f19fd8 | 17 | fgets( str , MAX_LEN-1 , fp ); |
marishi | 1:4b0cd1f19fd8 | 18 | pc.printf(str); |
marishi | 1:4b0cd1f19fd8 | 19 | |
marishi | 0:2acd856cf56b | 20 | fclose(fp); |
marishi | 0:2acd856cf56b | 21 | } |