Xx_Introduction
s_gets
is 《C primer plus》 optimize input foo.
Ax_Propose
Clear the cache._
Bx_Code
char * s_gets(char * st, int n)
{
char * ret_val;
char * find;
ret_val = fgets(st, n, stdin);
if (ret_val)
{
find = strchr(st, '
');
if (find)
{
*find = ' ';
}else
{
while (getchar() != '
')
continue;
}
return ret_val;
}
}