gpt4 book ai didi

c - 读取文件 : fscanf doesn't read whitespaces?

转载 作者:太空宇宙 更新时间:2023-11-04 07:08:52 24 4
gpt4 key购买 nike

我在使用 fscanf 从文件指针中获取行时遇到问题。

假设要获取这样一行:

<123324><sport><DESCfddR><spor ds>

Fscanf 只获取这部分:

<123324><sport><DESCfddR><spor

有人知道如何解决这个问题吗?

提前致谢。

最佳答案

总之,读取包含空格的行的最佳方法是使用 fgets:

fgets (currentLine, MAX_LENGTH , filePointer);

使用 fscanf 你会遇到很多问题。

关于c - 读取文件 : fscanf doesn't read whitespaces?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30005951/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com