25 lines
332 B
C
25 lines
332 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
FILE* flux = fopen("compte", "r");
|
||
|
int compte = 0;
|
||
|
|
||
|
if (flux) {
|
||
|
fread(&compte, 4, 1, flux);
|
||
|
}
|
||
|
|
||
|
compte++;
|
||
|
|
||
|
printf("%d\n", compte);
|
||
|
|
||
|
flux = fopen("compte", "w");
|
||
|
if (flux) {
|
||
|
fwrite(&compte, 4, 1, flux);
|
||
|
fclose(flux);
|
||
|
}
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|