如何在不输入命令提示符的情况下将光标移动到下一行?

时间:2019-02-10 00:21:14

标签: c string terminal

我刚刚开始学习C语言,现在很难弄清楚如何将字符串输入终端到不同的行中,如果此功能对我的代码有重大影响。我的程序应该读取从命令提示符输入的字符串,并显示5个最常用的单词。 zzzzz是终止符字符串

> i must not fear 
> fear is the mind killer 
> fear is the little death that brings total obliteration 
> i will face my fear 
> i will permit it to pass over me 
> and through me and when it has gone past i will turn the inner eye to see its path 
> where the fear has gone there will be nothing only
> i will remain 
> zzzzz 
>
> Count Word
> ===== ==== 
> 5     fear 
> 5     i 
> 5     will 
> 4     the 
> 2     and

在终端中,如何像上面的示例一样单独输入一行?而且,如果可以使用此功能,那么在使用fgets(char * str,int n,FILE * stream)之类的功能时是否会起作用?

0 个答案:

没有答案