首页 > 解决方案 > 如何在不使用倒带功能的情况下清除输入缓冲区?

问题描述

我曾经在 Visual Studio 2019 中使用 rewind() 函数清除输入缓冲区,但在 GCC 编译器中无法使用 rewind() 函数。(简单示例>>)

scanf("%s",temp);
rewind(stdin) /* Are there any ways to clear the input buffer?*/
  1. 我应该使用哪个函数来清除 GCC 编译器中的输入缓冲区?

  2. 有什么好的方法可以在不使用某些功能的情况下清除输入缓冲区?

标签: c

解决方案


推荐阅读