Greetings from Portugal
I've been stuck for some hours now, since I can't get my n00b code to work as I want. Could someone give me a hint of what to do or what am I doing wrong?
I have a file that writes something like this:
1001,Loja1,10
1002,Loja2,20
And I want to separatedely get the values separated by the ',' so here's what I've done so far
if(!fileLoja)
cout<<"Deu Asneira";
while(!fileLoja.eof())
{
getline(fileLoja,str,'\n');
if(str.size()>0)
{
int inicio = 0;
int pos = str.find(str,inicio);
string chave = str.substr(inicio, pos-inicio);
char *aux1= &chave[0];
int key = atoi(aux1);
pos++;
inicio = pos;
pos = str.find(',',inicio);
string descr = str.substr(inicio, pos-inicio);
inicio = pos;
pos = str.find(',',inicio);
string qenc = str.substr(inicio, pos-inicio);
char *aux = &qenc[0];
int quenc = atoi(aux);
pos++;
}
}
Now, how can I get it to write to some array out "coutIng" something to the screen?
Cheers,
João