与fgets指令得到skipped.Why? [英] fgets instructions gets skipped.Why?
本文介绍了与fgets指令得到skipped.Why?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我一个与fgets的与fgets指令被跳过前做一个scanf函数。我来翻过++这个问题在C和我记得我不得不有一些instrcution,将清除标准输入缓冲区或类似的东西。我想有一个为C.同等这是什么?
Whenever I do a scanf before a fgets the fgets instruction gets skipped. I have come accross this issue in C++ and I remember I had to had some instrcution that would clear the stdin buffer or something like that. I suppose there's an equivalent for C. What is it?
感谢。
推荐答案
我敢打赌,这是因为\\ n卡在输入流中
I'll bet it's because of the \n stuck in the input stream.
请参阅下面的一个问题:
See one of these questions:
我不能刷新标准输入。结果
我怎么去法拉盛STDIN这里?结果
scanf()的导致无限循环
或这个答案。
P.S。 与fgets()
是一个函数,而不是一个指令。
P.S. fgets()
is a function, not an instruction.
这篇关于与fgets指令得到skipped.Why?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文