【发布时间】:2019-07-20 13:58:04
【问题描述】:
我将直接从“gz”格式文件中读取数据。在c中使用“zlib”,我从gz文件中读取数据,现在我有一个无符号字符数组,即“str”。我想使用“sscanf”提取双数。这是我的代码:
printf("%s\n", str);
double d1,d2,d3;
sscanf(str, "%lf %lf %lf", &d1, &d2, &d3);
printf("%lf\n", &d1);
printf("%lf\n", &d2);
printf("%lf\n", &d3);
输出是:
23.323 1111.232 434434.1
0.000000
0.000000
0.000000
似乎我已经成功地从 gz 文件中读取了 str,但我无法从 str 中读取双精度。
【问题讨论】:
-
trr 使用
%1d而不是%1f
标签: c