Weird strtok() problem

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

Sorry if this sounds harsh, but there are numerous problems with your code's logic. Is it guarranteed that there are a max of 7 tokens in your strings? And that the size of those is 99 chars max? And that all of the lines in your file don't contain whitespace? (istream << reads until the whitespace! ;) )

A bit more foolproof version of the program would look like this for instance:

Clockowl: Your program will still fail if a line is too long since only part of the line will have been read, leaving the rest of that line to be read as the next line. It's probably best to forgo strtok altogether and just use C++ strings and member functions like find_first_of and substr. (Also note that the version presented below definitely needs the colon at the end of the line, as in the OP's original data file.)