更新时间:2023-02-26 11:03:05
而不是告诉你不要使用 scanf()
的答案,你可以否定扫描集 scanf()
选项:
Rather than the answers that tell you not to use scanf()
, you can just the the Negated scanset option of scanf()
:
scanf("%99[^
]",comment); // This will read into the string: comment
// everything from the next 99 characters up until
// it gets a newline