1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
/* tmpfile example */
#include <stdio.h>
#include <string.h>
int main ()
{
char buffer [256];
FILE * pFile;
pFile = tmpfile ();
do {
if (!fgets(buffer,256,stdin)) break;
fputs (buffer,pFile);
} while (strlen(buffer)>1);
rewind(pFile);
while (!feof(pFile)) {
if (fgets (buffer,256,pFile) == NULL) break;
fputs (buffer,stdout);
}
fclose (pFile);
return 0;
}
|