Skip to content

Commit e1a8abf

Browse files
committed
fix the value+s bug
1 parent 882deb0 commit e1a8abf

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
*.png
44
*.zip
55
*.S
6-
*.txt
6+
*.txt
7+
/build

COMPACT3.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ int CCOMPACT3::loadfile(string pfile)
9898
{
9999
for (int i = 0; i < xRecord->num; ++i)
100100
{
101-
word >> (xRecord->fvalue[i]);
101+
std::string temp;
102+
word >> temp;
103+
xRecord->fvalue[i] = std::strtof(temp.c_str(), NULL);
102104
}
103105
m_vRecord.push_back(xRecord);
104106
}

test.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
// test.cpp : 定义控制台应用程序的入口点。
1+
// test.cpp : �������̨Ӧ�ó������ڵ㡣
22
//
33

44
#include "COMPACT3.h"
55

66
int main(int argc, char* argv[]) {
77
CCOMPACT3 compacts3;
8-
compacts3.loadfile("..//TESTDATA//o.m12");
8+
compacts3.loadfile("..//..//data//data.d12");
99
for (int i=0;i<compacts3.count();++i) {
1010
const CCOMPACT3Record * record = compacts3.get(i);
11-
printf("%d\n", record->num);
11+
12+
for(int j=0;j<record->num;++j)
13+
{
14+
printf("%f ", record->fvalue[j]);
15+
}
16+
printf("\n");
1217
}
1318
return 0;
1419
}

0 commit comments

Comments
 (0)