Tedd OKANO
/
M0_restert_by_file_open_close_repeat
sample of problem: M0 restarted by file-open-close repeat 146 times
main.cpp@1:15bd9459aa18, 2012-04-17 (annotated)
- Committer:
- okano
- Date:
- Tue Apr 17 06:10:59 2012 +0000
- Revision:
- 1:15bd9459aa18
- Parent:
- 0:499e5f2fe4b3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okano | 0:499e5f2fe4b3 | 1 | #include "mbed.h" |
okano | 0:499e5f2fe4b3 | 2 | |
okano | 0:499e5f2fe4b3 | 3 | LocalFileSystem SeqFile("Local"); |
okano | 0:499e5f2fe4b3 | 4 | |
okano | 0:499e5f2fe4b3 | 5 | int main() { |
okano | 0:499e5f2fe4b3 | 6 | FILE *fp; |
okano | 0:499e5f2fe4b3 | 7 | int i = 1; |
okano | 0:499e5f2fe4b3 | 8 | |
okano | 0:499e5f2fe4b3 | 9 | printf( "\r\nSTART\r\n" ); |
okano | 0:499e5f2fe4b3 | 10 | wait( 0.1 ); |
okano | 0:499e5f2fe4b3 | 11 | |
okano | 0:499e5f2fe4b3 | 12 | while ( 1 ) { |
okano | 1:15bd9459aa18 | 13 | fp = fopen( "/Local/TEST.csv", "r" ); |
okano | 0:499e5f2fe4b3 | 14 | if (!fp) { |
okano | 0:499e5f2fe4b3 | 15 | printf( "error %d\r\n", i ); |
okano | 0:499e5f2fe4b3 | 16 | exit( 1 ); |
okano | 0:499e5f2fe4b3 | 17 | } else { |
okano | 0:499e5f2fe4b3 | 18 | printf( "%d (%p)\r\n", i, fp ); |
okano | 0:499e5f2fe4b3 | 19 | fclose( fp ); |
okano | 0:499e5f2fe4b3 | 20 | } |
okano | 0:499e5f2fe4b3 | 21 | wait( 0.1 ); |
okano | 0:499e5f2fe4b3 | 22 | i++; |
okano | 0:499e5f2fe4b3 | 23 | } |
okano | 0:499e5f2fe4b3 | 24 | } |