Programme carte strategie (disco)
Dependencies: mbed SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Instruction/lecture_repertoire.cpp@60:c7632af62d21, 2019-05-23 (annotated)
- Committer:
- kyxstark
- Date:
- Thu May 23 15:53:48 2019 +0000
- Revision:
- 60:c7632af62d21
- Parent:
- 29:41e02746041d
Carte strat plus lib , mais programme
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 |