I am not able to flush stdin

后端 未结 7 1924
孤城傲影
孤城傲影 2020-11-22 14:51

How to flush the stdin??

Why is it not working in the following code snippet?

#include 
#include 
#i         


        
7条回答
  •  Happy的楠姐
    2020-11-22 15:05

    You are overriding the last element of the input in arg with '\0'. That line should be arg[i]='\0'; instead (after error and boundary checking you are missing.)

    Other's already commented of the flushing part.

提交回复
热议问题