2 // masashi shimakura 20140223
11 int counts(char * path_name, int min, int max)
27 data = (char *)calloc(BUF_LEN, sizeof(char));
29 if(0 >= (int)strlen(path_name)){
30 path_name = safe_memcpy(path_name, "/tmp/taro.count", BUF_LEN);
33 if((fp = fopen(path_name, "r+"))!=NULL){
34 data = safe_fpcat(fp, data, &stat, BUF_LEN);
36 data = safe_memcpy(data, "0\n", BUF_LEN);
41 fprintf(stderr,"counts(): file not read open %s\n", path_name);
44 count = strtol(data, (char **)NULL, 10);
61 if((fp = fopen(path_name, "w+"))!=NULL){
62 fprintf(fp,"%d\n", count);
66 fprintf(stderr,"counts(): file not write open %s\n", path_name);