利用fgets,fputs的回显程序

时间:2014-06-26 00:18:04   收藏:0   阅读:256

#include <stdio.h>

#define MAXLINE 20

int main(void)

{

char line[MAXLINE];

while(fgets(line,MAXLINE,stdin) != NULL && line[0] != ‘\n‘)

   fputs(line, stdout);

return 0;

}

 

//fgets函数保留了换行符,而fputs函数不会添加换行符。

利用fgets,fputs的回显程序,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!