Programme carte strategie (disco)
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Instruction/lecture_repertoire.cpp@29:41e02746041d, 2018-04-06 (annotated)
- Committer:
- Sitkah
- Date:
- Fri Apr 06 13:47:19 2018 +0000
- Revision:
- 29:41e02746041d
version fusionn?e
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sitkah | 29:41e02746041d | 1 | #include "global.h" |
Sitkah | 29:41e02746041d | 2 | |
Sitkah | 29:41e02746041d | 3 | |
Sitkah | 29:41e02746041d | 4 | struct dirent* files_name[10]; |
Sitkah | 29:41e02746041d | 5 | char *rest; |
Sitkah | 29:41e02746041d | 6 | |
Sitkah | 29:41e02746041d | 7 | |
Sitkah | 29:41e02746041d | 8 | void lecture_fichier(void){ |
Sitkah | 29:41e02746041d | 9 | short i,j; |
Sitkah | 29:41e02746041d | 10 | |
Sitkah | 29:41e02746041d | 11 | DIR* rep = NULL; |
Sitkah | 29:41e02746041d | 12 | |
Sitkah | 29:41e02746041d | 13 | mkdir("/sd", 0777); |
Sitkah | 29:41e02746041d | 14 | strcpy(cheminFileStart,"/sd"); |
Sitkah | 29:41e02746041d | 15 | rep=opendir("/sd"); |
Sitkah | 29:41e02746041d | 16 | |
Sitkah | 29:41e02746041d | 17 | for(i=0;i<20;i++){ |
Sitkah | 29:41e02746041d | 18 | files_name[i]= readdir(rep); |
Sitkah | 29:41e02746041d | 19 | |
Sitkah | 29:41e02746041d | 20 | if(files_name[i]->d_name==""){ |
Sitkah | 29:41e02746041d | 21 | i=20; |
Sitkah | 29:41e02746041d | 22 | } |
Sitkah | 29:41e02746041d | 23 | else{ |
Sitkah | 29:41e02746041d | 24 | strcpy(strat_sd[i-j],files_name[i]->d_name); |
Sitkah | 29:41e02746041d | 25 | rest=strstr(strat_sd[i-j],".txt"); |
Sitkah | 29:41e02746041d | 26 | |
Sitkah | 29:41e02746041d | 27 | if(rest==NULL){ |
Sitkah | 29:41e02746041d | 28 | strcpy(strat_sd[i-j],""); |
Sitkah | 29:41e02746041d | 29 | j++; |
Sitkah | 29:41e02746041d | 30 | } |
Sitkah | 29:41e02746041d | 31 | else{ |
Sitkah | 29:41e02746041d | 32 | strcpy(strat_sd[i-j],strtok(strat_sd[i-j],".")); |
Sitkah | 29:41e02746041d | 33 | } |
Sitkah | 29:41e02746041d | 34 | |
Sitkah | 29:41e02746041d | 35 | } |
Sitkah | 29:41e02746041d | 36 | } |
Sitkah | 29:41e02746041d | 37 | } |
Sitkah | 29:41e02746041d | 38 |