v2019
Dependencies: CRAC-Strat_2019 SerialHalfDuplex SDFileSystem DISCO-F469NI_portrait liaison_Bluetooth ident_crac
Dependents: Codeprincipal_2019 CRAC-Strat_2019
Diff: Instruction/Instruction.cpp
- Revision:
- 4:88431b537477
- Parent:
- 1:116040d14164
- Child:
- 11:ed13a480ddca
diff -r 19f2285a4757 -r 88431b537477 Instruction/Instruction.cpp --- a/Instruction/Instruction.cpp Sun Apr 17 08:31:59 2016 +0000 +++ b/Instruction/Instruction.cpp Sun Apr 17 14:03:03 2016 +0000 @@ -66,7 +66,10 @@ } } - +/****************************************************************************************/ +/* FUNCTION NAME: stringToInstruction */ +/* DESCRIPTION : Conversion d'une ligne du fichier de strat en instruction */ +/****************************************************************************************/ struct S_Instruction stringToInstruction(char line[]) { struct S_Instruction instruction; @@ -112,6 +115,12 @@ return instruction; } +/****************************************************************************************/ +/* FUNCTION NAME: loadAllInstruction */ +/* DESCRIPTION : Charger toutes les instructions du fichier de stratégie */ +/* Il faut utiliser strcpy(cheminFileStart,"/local/strat.txt"); */ +/* pour indiquer le fichier à utiliser */ +/****************************************************************************************/ void loadAllInstruction(void) { struct S_Instruction instruction; @@ -136,3 +145,18 @@ fclose(testFile); } + +/****************************************************************************************/ +/* FUNCTION NAME: FileExists */ +/* DESCRIPTION : Permet de vérifier si un fichier existe */ +/****************************************************************************************/ +int FileExists(const char *fname) +{ + FILE *file; + if (file = fopen(fname, "r")) + { + fclose(file); + return 1; + } + return 0; +}