APL/APL1.2/Dev1.2/Fichiers/Compteur.C
2021-12-02 15:42:49 +01:00

34 lines
801 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* const argv[])
{
FILE *file;
int a;
int cpt;
int i;
int b=0;
if(file = fopen("cpt", "r"))
{
fclose(file);
file = fopen("cpt", "w");
fread(&a,sizeof(int),1,file);
b=a+1;
printf("%d", a);
fclose(file);
file = fopen("cpt", "w");
fwrite(&b,sizeof(int),1,file);
fclose(file);
}
else
{
fclose(file);
file = fopen("cpt", "w");
fread(&a,sizeof(int),1,file);
fwrite(&b,sizeof(int),1,file);
}
/*
f
*/
return EXIT_SUCCESS;
}