Created
December 22, 2015 16:41
-
-
Save luistelmocosta/9d25d4f3b07d49b53578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Campeonato::readFileBilhetes(string filename) { | |
fstream infile(filename.c_str()); | |
string linha, dono; | |
int dia, mes, ano; | |
vector<int> campeonatoIds; | |
while (getline(infile, dono)) // get name and check status file stream | |
{ | |
cout << dono << endl; | |
// read in date | |
getline(infile, linha); | |
istringstream iss (linha); | |
string tmpstr1; | |
getline(iss, tmpstr1, '/'); | |
dia = atoi(tmpstr1.c_str()); | |
getline(iss, tmpstr1, '/'); | |
mes = atoi(tmpstr1.c_str()); | |
getline(iss, tmpstr1, '/'); | |
ano = atoi(tmpstr1.c_str()); | |
cout << dia << "/" << mes << "/" << ano << endl; | |
// read in competition ids | |
getline(infile, linha); | |
istringstream iss2(linha); | |
string tmpstr2; | |
while (getline(iss2, tmpstr2, ',')) | |
{ | |
campeonatoIds.push_back(atoi(tmpstr2.c_str())); | |
} | |
for (unsigned int i = 0; i < campeonatoIds.size(); i++) { | |
{ | |
cout << campeonatoIds[i] << ","; | |
cout << endl; | |
campeonatoIds.clear(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment