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@22:c7763a7ec6c7, 2020-06-26 (annotated)
- Committer:
- gabrieltetar
- Date:
- Fri Jun 26 13:08:54 2020 +0000
- Revision:
- 22:c7763a7ec6c7
- Parent:
- 1:7e925468f9d9
- Child:
- 24:1a13c998c7ac
IHM VERSION TETAR
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; |
gabrieltetar | 1:7e925468f9d9 | 6 | |
gabrieltetar | 1:7e925468f9d9 | 7 | |
gabrieltetar | 1:7e925468f9d9 | 8 | void lecture_fichier(void){ |
gabrieltetar | 1:7e925468f9d9 | 9 | short i,j; |
gabrieltetar | 1:7e925468f9d9 | 10 | |
gabrieltetar | 1:7e925468f9d9 | 11 | DIR* rep = NULL; |
gabrieltetar | 1:7e925468f9d9 | 12 | |
gabrieltetar | 22:c7763a7ec6c7 | 13 | if(mkdir("/sd", 0777)==0){//0 SUCCES -1 ECHEC |
gabrieltetar | 1:7e925468f9d9 | 14 | strcpy(cheminFileStart,"/sd"); |
gabrieltetar | 1:7e925468f9d9 | 15 | rep=opendir("/sd"); |
gabrieltetar | 22:c7763a7ec6c7 | 16 | demarrage(2); |
gabrieltetar | 1:7e925468f9d9 | 17 | for(i=0;i<20;i++){ |
gabrieltetar | 1:7e925468f9d9 | 18 | files_name[i]= readdir(rep); |
gabrieltetar | 1:7e925468f9d9 | 19 | |
gabrieltetar | 1:7e925468f9d9 | 20 | if(files_name[i]->d_name==""){ |
gabrieltetar | 1:7e925468f9d9 | 21 | i=20; |
gabrieltetar | 1:7e925468f9d9 | 22 | } |
gabrieltetar | 1:7e925468f9d9 | 23 | else{ |
gabrieltetar | 1:7e925468f9d9 | 24 | strcpy(strat_sd[i-j],files_name[i]->d_name); |
gabrieltetar | 1:7e925468f9d9 | 25 | rest=strstr(strat_sd[i-j],".txt"); |
gabrieltetar | 1:7e925468f9d9 | 26 | |
gabrieltetar | 1:7e925468f9d9 | 27 | if(rest==NULL){ |
gabrieltetar | 1:7e925468f9d9 | 28 | strcpy(strat_sd[i-j],""); |
gabrieltetar | 1:7e925468f9d9 | 29 | j++; |
gabrieltetar | 1:7e925468f9d9 | 30 | } |
gabrieltetar | 1:7e925468f9d9 | 31 | else{ |
gabrieltetar | 1:7e925468f9d9 | 32 | strcpy(strat_sd[i-j],strtok(strat_sd[i-j],".")); |
gabrieltetar | 1:7e925468f9d9 | 33 | } |
gabrieltetar | 1:7e925468f9d9 | 34 | |
gabrieltetar | 1:7e925468f9d9 | 35 | } |
gabrieltetar | 1:7e925468f9d9 | 36 | } |
gabrieltetar | 22:c7763a7ec6c7 | 37 | } |
gabrieltetar | 1:7e925468f9d9 | 38 | } |
gabrieltetar | 1:7e925468f9d9 | 39 |