你知道如何用流中的单词填充数组吗?这是我现在所能做到的:
ifstream db;
db.open("db") //1stline: one|two|three, 2d line: four|five|six....
int n=0,m=0;
char a[3][20];
char c[20];
while(db.get(ch)) {
if(ch=='|') {
a[0][m]=*c;
m++;
}
else {
c[n]=ch;
n++;
}
}
所以它看起来像 {{one,two,three},{four,five,six},{seven,eight,nine},...}