开发者

sscanf match double

sscanf(str, "%lf", &num);

Here I try to parse a开发者_如何学JAVA double. It catches inf which is fine. However it also catches infififi as inf, which is wrong in my case.

Other examples would be nandoscope as nan and 123abc as 123. How to fix this behavior?


That's by design, so it doesn't need fixing. Perhaps you can rewrite your code to read a delimiter after the double, or see if sscanf is reading the whole string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜