code avec modifs, programme mit dans les robots pour les derniers matchs
Dependencies: mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait
Instruction/lecture_repertoire.cpp@29:ff575aff301f, 2021-03-17 (annotated)
- Committer:
- slowness
- Date:
- Wed Mar 17 08:13:52 2021 +0000
- Revision:
- 29:ff575aff301f
- Parent:
- 24:1a13c998c7ac
version correction de la sd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gabrieltetar | 1:7e925468f9d9 | 1 | #include "global.h" |
gabrieltetar | 1:7e925468f9d9 | 2 | |
gabrieltetar | 1:7e925468f9d9 | 3 | |
gabrieltetar | 1:7e925468f9d9 | 4 | struct dirent* files_name[10]; |
gabrieltetar | 1:7e925468f9d9 | 5 | char *rest; |
slowness | 29:ff575aff301f | 6 | char sd_present=0; |
gabrieltetar | 1:7e925468f9d9 | 7 | |
gabrieltetar | 1:7e925468f9d9 | 8 | |
gabrieltetar | 1:7e925468f9d9 | 9 | void lecture_fichier(void){ |
gabrieltetar | 1:7e925468f9d9 | 10 | short i,j; |
gabrieltetar | 1:7e925468f9d9 | 11 | |
gabrieltetar | 1:7e925468f9d9 | 12 | DIR* rep = NULL; |
gabrieltetar | 1:7e925468f9d9 | 13 | |
gabrieltetar | 24:1a13c998c7ac | 14 | mkdir("/sd", 0777); |
slowness | 29:ff575aff301f | 15 | strcpy(cheminFileStart,"/sd"); |
slowness | 29:ff575aff301f | 16 | rep=opendir("/sd"); |
slowness | 29:ff575aff301f | 17 | |
slowness | 29:ff575aff301f | 18 | for(i=0;i<20;i++) |
slowness | 29:ff575aff301f | 19 | { |
slowness | 29:ff575aff301f | 20 | files_name[i]= readdir(rep); |
slowness | 29:ff575aff301f | 21 | |
slowness | 29:ff575aff301f | 22 | if(files_name[i]->d_name=="") |
slowness | 29:ff575aff301f | 23 | { |
slowness | 29:ff575aff301f | 24 | i=20; |
slowness | 29:ff575aff301f | 25 | } |
slowness | 29:ff575aff301f | 26 | else |
slowness | 29:ff575aff301f | 27 | { |
slowness | 29:ff575aff301f | 28 | sd_present=1; |
slowness | 29:ff575aff301f | 29 | strcpy(strat_sd[i-j],files_name[i]->d_name); |
slowness | 29:ff575aff301f | 30 | rest=strstr(strat_sd[i-j],".txt"); |
gabrieltetar | 1:7e925468f9d9 | 31 | |
slowness | 29:ff575aff301f | 32 | if(rest==NULL) |
slowness | 29:ff575aff301f | 33 | { |
slowness | 29:ff575aff301f | 34 | strcpy(strat_sd[i-j],""); |
slowness | 29:ff575aff301f | 35 | j++; |
slowness | 29:ff575aff301f | 36 | } |
slowness | 29:ff575aff301f | 37 | else |
slowness | 29:ff575aff301f | 38 | { |
slowness | 29:ff575aff301f | 39 | strcpy(strat_sd[i-j],strtok(strat_sd[i-j],".")); |
slowness | 29:ff575aff301f | 40 | } |
slowness | 29:ff575aff301f | 41 | |
slowness | 29:ff575aff301f | 42 | } |
gabrieltetar | 1:7e925468f9d9 | 43 | } |
gabrieltetar | 1:7e925468f9d9 | 44 | } |
gabrieltetar | 1:7e925468f9d9 | 45 |