R
Rui Maciel
I'm writing a program that supports input from stdin. To be able to do that I tend to rely on a simple loop
that tests the return of fgets(), such as the following example:
if (fgets (buffer, BUFFER_SIZE, stdin) != NULL)
{
// read the buffer
}
I've been doing this for a while but I'm not sure that this is the best way to handle it. A quick google on
the subject failed to return any meaningful result and searching this group's history through google groups
ended up being a very disappointing experience (a search for nothing more than "stdin" returns only 14
results that only go as far as June 8th). So, what's the best way to handle input from stdin?
Thanks in advance,
Rui Maciel
that tests the return of fgets(), such as the following example:
if (fgets (buffer, BUFFER_SIZE, stdin) != NULL)
{
// read the buffer
}
I've been doing this for a while but I'm not sure that this is the best way to handle it. A quick google on
the subject failed to return any meaningful result and searching this group's history through google groups
ended up being a very disappointing experience (a search for nothing more than "stdin" returns only 14
results that only go as far as June 8th). So, what's the best way to handle input from stdin?
Thanks in advance,
Rui Maciel