C++ C+中的数据提取+;
大家好,我正在使用代码从数据文件中读取C++ C+中的数据提取+;,c++,C++,大家好,我正在使用代码从数据文件中读取 //................ //................... char databuff[20]; char ch; for(int i=0;i<15;i++) { f[0].getline(databuff,((2*sizeof(double))+(2*sizeof(char)))); //............... //............... cDisp
//................
//...................
char databuff[20];
char ch;
for(int i=0;i<15;i++) {
f[0].getline(databuff,((2*sizeof(double))+(2*sizeof(char))));
//...............
//...............
cDisp=databuff;
cDisp1+=cDisp;
cDisp1+="\r\n";
}
GetDlgItem(IDC_DISPLAYFILE)->SetWindowTextW(cDisp1);
/。。。。。。。。。。。。。。。。
//...................
char-databuff[20];
char ch;
对于(int i=0;iSetWindowTextW(cDisp1);
现在数据似乎是两个双浮点数,由“”分隔,“
如何从我在代码中使用的databuff中提取两个不同双变量中的两个双值?程序的输出如下……
0334.152
0.013333334.152
0.02667334.143
0.04334.143
0.0533334.134
0.06667334.125
0.08334.125
0.0933334.125
0.106667334.116
0.12334.116
0.13333334.116
0.14667334.116
0.16334.125
0.1733334.134
0.186667334.431您可以在数据缓冲区的顶部创建一个strstrstream,只需使用双d0,d1;chart;str>>d0>>t>>d1;
可选的,你可以尝试<代码> Strugr <代码>来定位“,”,然后在两个子串上使用<<代码> <代码>:(STD::如果你想要C++模式),请你建议我如何在数据包上使用StruChr?我的程序的输出类似于334.152。