Hello,
I have to read a file which, among other data, contains here and there lines with the format
# word1 number, word2 number
word1 and word2 are always the same words, the comma is always in the same place (after the first number), but the numbers change, and could have one, two, or three digits. I need to save those numbers as ints.
Detecting the lines while reading the file is of course very easy, but extracting the numbers is proving much more difficult for me.
I tried a very add-hoc code that looks at the whole line as string and has lots of if statements, but it is not working. I also found in this forum a post about using strtok for a situation like mine, but I am still confused. I should say that I am not a programmer, but someone who needs to write a C program for research, and who has learned by imitating examples and the kind advise of people in forums like this.
Any help would be much appreciated.
Thanks,
mc61