Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int numero_de_execucoes;
- FILE *total;
- numero_de_execucoes = 0;
- total = fopen("total.txt", "w+");
- if(total){
- while(!feof(total)){
- fscanf(total , "%d", &numero_de_execucoes);//lendo o ultimo numero_de_execucoes
- }
- }
- else{
- printf("ERRO");
- }
- numero_de_execucoes += 1;//incrementando + 1
- fprintf(total, "%d", numero_de_execucoes);//escrevendo no arquivo o
- //numero_de_execucoes atual
- fclose(total);
- printf("%d",numero_de_execucoes);//saida
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement