Question About Reading Lines from stdin
I was just wondering if it's possible to do the following. Is it possible to use fgets to read in lines from stdin more than once? For example, could you go:
Basically, I want to know if it's possible to read in lines from stdin once, and then read in lines again from the beginning? I thought of this because I was thinking of a way to calculate the size of input given from stdin, and then doing something else with the lines from stdin later on. Does this even make sense? Thanks for the help.
while (fgets(buf,BUFSIZ,stdin) != NULL)
// do something
while ( fgets(buf2,BUFSIZ,stdin) != NULL)
//do something else