我的两列数据
0 3470
1 3482
2 3497
3 3513
4 3527
5 3529
6 3556
7 3579
8 3580
一共1080行
#include<iostream>
#include<fstream>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
int x[1080][2];
int j,i,n=0;
FILE *fp;
fp=fopen("ss.csv","r");
if(!feof(fp)){
cout << " open file" << endl;
while(1){
fscanf(fp,"%x,%x",&x[n][0],&x[n][1]);
if (feof(fp))break;
n++;}
}else
cout << "Cannot open file" << endl;
fclose(fp);
printf("n=%d\n",n);
for (j=0;j<n;j++){
for (i=0;i<2;i++)
printf("%x ",x[j][i]);
printf("\n");
}
system("pause");
return 0;
}
输出