scanf读入有空格字符串

当不支持gets时,getline又比较慢,可以使用scarf("%[^\n]s", str);来读入以换行表示读完的字符串,其中[^char]表示以char为结束。

转载于:https://www.cnblogs.com/AlphaWA/p/11379939.html

你可能感兴趣的:(scanf读入有空格字符串)