代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
FILE *temp;
char c;
/* FILE *tmpfile() */
if ( (temp = tmpfile()) != NULL )
fputs("\nHello World!\nHello ", temp);
/* void rewind(FILE *fp) */
rewind(temp);
while ((c = fgetc(temp)) != EOF)
printf("%c", c);
printf("\n");
fclose(temp);
return 0;
}
运行结果: