hallo, community,
ich habe eine csv datei in folgendem format:
1;Air Elemental;0;0000;0000;
2;Ancestral Recall;1;0001;0100;
3;Animate Artifact;2;0002;0200;
4;Animate Dead;3;0003;0300;
5;Animate Wall;4;0004;0400;...
ich möchte die datei als array in c++ auslesen.
wie funzt das am besten?
wo muss die datei hinterlegt sein um das richtig auszulesen, und wie ist das mit den pfadangeben?
ich habe Code::Blocks 13.12 als editor, und GDB:CDG debugger.
Quote:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
double data[6][764];
int count = 1;
int bigcount = 1;
int main() {
ifstream file;
file.open("./cl.csv");
while (bigcount < 765)
{
while (count < 7)
{
getline(file, data[count][bigcount], ',');
count++;
}
bigcount++;
}
file.close();
return 0;
}
|
wie muss die pfadangabe sein, wenn die csv datei im ordner des projektes liegt?
sorry, ich bin neu hier, aber als hintergrundinfo, es soll ein savegame editor für magic the gathering 1997 werden.