파일을 읽어와서 +1 한 후에 저장한다.
확 그냥 만들어 버렸다.
#include<stdio.h>

int main(int argc, char **argv){
   
    FILE *count;
    count = fopen(argv[1], "r");
    if(argv==0 || count==NULL){
        return 1;
    }
   
    int c = 0;
    fscanf(count, "%d", &c);
    fclose(count);
    count = fopen(argv[1], "w");
    fprintf(count, "%d", ++c);
    fclose(count);
    return 0;
}

더 이상의 설명은 생략한다.
by snowall 2010. 7. 3. 08:49