前言部份
函式名: rewind
功 能: 將檔案指針重新指向一個流的開頭
用 法: int rewind(FILE *stream);
舉例說明
程式例:
#include
#include
int main(void)
{
FILE *fp;
char *fname = "TXXXXXX", *newname, first;
newname = mktemp(fname);
fp = fopen(newname,"w+");
fprintf(fp,"abcdefghijklmnopqrstuvwxyz");
rewind(fp);
fscanf(fp,"%c",&first);
printf("The first character is: %c\n",first);
fclose(fp);
remove(newname);
return 0;
}