利用fgets代替gets

来源:互联网 发布:linux进程通信 编辑:程序博客网 时间:2024/04/28 01:37

fgets (pn->first, SLEN, stdin);
 i = 0;
 while (pn->first[i] != '/n' && pn->first[i] != '/0')
  i++;
 if (pn->first[i] == '/n')
  pn->first[i] = '/0';
 else
  while (getchar () != '/n')
   continue;