简体   繁体   English

如何扫描包含空格和制表符的字符串?

[英]How to scan a string including the Space and Tab?

I'm often using C code to take some input and manipulate it;我经常使用 C 代码来获取一些输入并对其进行操作; for example, I want to scan a full phrase like "hello world" but as it contains a space, I find myself forced to use "gets" to include the spaces or even tabs sometimes.例如,我想扫描像“hello world”这样的完整短语,但由于它包含一个空格,我发现自己有时不得不使用“gets”来包含空格甚至制表符。

you cant use scanf() or fgets , just remember use the stdin as input stream你不能使用scanf()fgets ,只记得使用标准输入作为输入stdin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM