MinnisotaFreezing
Programmer
Sorry if this is an easy question, I searched Google and Tek-Tips, and cant find what I want.
I have a .txt file with 100 words seperated by a delimiter. I want to read just the nth word.
What I can do is read in a line, or the file, then use strtok or CString.Find and find the 15th and 16th comma, then read the word in the middle, and trim the white space. What I want to do is just get that 15th word, or 67th word, or whatever. I can probably use peek to check, but its been a while.
The $1000 doller question is, does it matter? If I want the 15th word, I suppose I have to access all the data before the 15th word to find the 15th word anyway. Does it matter if I do it using file I/O, or is it just as efficent to read the whole file into a buffer, and then parse my data that way.
Best world would be to use MySql or Access, but that is not possible. Barring that, is there anything more efficent that a simple delimited text file?
Thanks for your help.
I have a .txt file with 100 words seperated by a delimiter. I want to read just the nth word.
What I can do is read in a line, or the file, then use strtok or CString.Find and find the 15th and 16th comma, then read the word in the middle, and trim the white space. What I want to do is just get that 15th word, or 67th word, or whatever. I can probably use peek to check, but its been a while.
The $1000 doller question is, does it matter? If I want the 15th word, I suppose I have to access all the data before the 15th word to find the 15th word anyway. Does it matter if I do it using file I/O, or is it just as efficent to read the whole file into a buffer, and then parse my data that way.
Best world would be to use MySql or Access, but that is not possible. Barring that, is there anything more efficent that a simple delimited text file?
Thanks for your help.