Hey i have a weird problem when im trying to print out elements in my temp pointer array, at the bottom where im just using cout to print random indexs of temp, it will only work if i comment out temp[1]... anyone have any idea why? if its not commented out, it doesnt print anything, even from the other couts
int main(){
ifstream ins;
ins.open("Line.txt", ios::in);
char *temp[7];
char line[100];
while(!ins.eof() && ins.good())
{
int i = 0;
ins >> line;
cout << line << endl;
temp[i] = strtok(line, ":");
while(temp[i] != NULL)
{
i++;
temp[i] = strtok(NULL, ":");
}
cout << temp[0] << endl;
//cout << temp[1] << endl;
cout << temp[5] << endl;
cout << temp[4] << endl;
}
}
my lines.txt file just has random stuff like
erge:hguir:ieowrj:wre:tg:erf:qwer:
htr:hty:wer:Reg:rht:wef:trg:
34:trgh:wer:234:er:rg:234: