목차
없음
본문내용
while ( 1 )
{
gets(line);
if ( strlen(line) >= 4 && strstr(line, "0000") != NULL ) {
line[strlen(line)-4] = '\0';
fputs(line, fp); fputs("\n", fp);
break;
} else {
fputs(line, fp); fputs("\n", fp);
}
}
//prtObject(g_data, &g_dataCnt, 1);
fclose(fp);
}
/* 함수 : procView
* 기능 : 일기 보기 프로세스
*/
void procView()
{
int nChoice;
FILE *fp;
char filepath[128];
char readbuf[1024];
prtObject(g_data, &g_dataCnt, 1);
printf("선택하실 번호 : ");
fflush(stdin); scanf("%d", &nChoice);
if ( nChoice <= 0 || (unsigned int)nChoice > g_dataCnt ) {
printf("없는 번호입니다.\n");
return;
} else {
nChoice--;
}
sprintf(filepath, "%s/%s", DATA_DIR, g_data[nChoice].szFileNM);
fp = fopen(filepath, "rb");
if ( fp == NULL ) {
printf("%s file open error : %s\n", g_data[nChoice].szFileNM, strerror(errno));
return;
}
{
gets(line);
if ( strlen(line) >= 4 && strstr(line, "0000") != NULL ) {
line[strlen(line)-4] = '\0';
fputs(line, fp); fputs("\n", fp);
break;
} else {
fputs(line, fp); fputs("\n", fp);
}
}
//prtObject(g_data, &g_dataCnt, 1);
fclose(fp);
}
/* 함수 : procView
* 기능 : 일기 보기 프로세스
*/
void procView()
{
int nChoice;
FILE *fp;
char filepath[128];
char readbuf[1024];
prtObject(g_data, &g_dataCnt, 1);
printf("선택하실 번호 : ");
fflush(stdin); scanf("%d", &nChoice);
if ( nChoice <= 0 || (unsigned int)nChoice > g_dataCnt ) {
printf("없는 번호입니다.\n");
return;
} else {
nChoice--;
}
sprintf(filepath, "%s/%s", DATA_DIR, g_data[nChoice].szFileNM);
fp = fopen(filepath, "rb");
if ( fp == NULL ) {
printf("%s file open error : %s\n", g_data[nChoice].szFileNM, strerror(errno));
return;
}
소개글