08/10/15 22:35:55
>>353 >>338
#include <stdio.h>
#include <string.h>
#define MAX 128
int main(void) {
char buf[MAX];
int i=1,ch;
FILE *tmp=tmpfile();
if(tmp==NULL) {perror(""); return 1;}
while (fgets(buf, MAX, stdin) != NULL) fwrite(buf,strlen(buf),1,tmp); /* function */
rewind(tmp);
do{
printf("%d: ",i++);
while((ch=fgetc(tmp))!='\n' && ch!=EOF) putchar(ch);
puts("");
}while( ch != EOF );
return 0; }