Entrainements + fin TP structures
This commit is contained in:
0
DEV1.1/TP24/TP24_reponses.txt
Normal file
0
DEV1.1/TP24/TP24_reponses.txt
Normal file
28
DEV1.1/TP24/test.c
Normal file
28
DEV1.1/TP24/test.c
Normal file
@@ -0,0 +1,28 @@
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
FILE* fichier = NULL;
|
||||
char* lu;
|
||||
char caractere;
|
||||
|
||||
fichier = fopen(argv[1], "r+");
|
||||
if (fichier == NULL) {
|
||||
printf("Erreur d'ouverture.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
lu = fgets(&caractere, sizeof(char), fichier);
|
||||
while (lu != NULL) {
|
||||
if (caractere == 'e') {
|
||||
printf("%c", )
|
||||
fseek(fichier, -1, SEEK_CUR);
|
||||
fputs("X", fichier);
|
||||
fseek(fichier, 0, SEEK_CUR);
|
||||
}
|
||||
lu = fgets(&caractere, sizeof(char), fichier);
|
||||
}
|
||||
|
||||
free(fichier);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
1
DEV1.1/TP24/test_e.txt
Normal file
1
DEV1.1/TP24/test_e.txt
Normal file
@@ -0,0 +1 @@
|
||||
Ceci est un test avec des e.
|
Reference in New Issue
Block a user