질문자 님이 쓰신 글 :
: 첨부터 다시 읽어 드릴려면 어떻게 해야 하죠?
:
: fclose해서 파일 닿은 후에 다시 fopen하니 첨부터 읽히긴 하는데
: 이런 방법 말고 다시 파일 처음으로 돌아가는 방법이 뭐가 있나요??
:
//FILE *fp = fopen("SomeFile.ext","r");
rewind(fp);
또는
fseek(fp,0,SEEK_SET); //fseek(fp,0,0);
void rewind(FILE *stream);
int fseek(FILE *stream, long offset, int whence);
whence는 아래의 값 중 하나를 지정
SEEK_SET 0 File beginning
SEEK_CUR 1 Current file pointer position
SEEK_END 2 End-of-file
|