Original Post
I always found reading files somewhat difficult and confusing, but this time I encountered the most difficult problem ever:
I have a txt file with contents like this:
v500 v1 v3 p5 ;lala
v601 p3 v50 v3.1415
p50 v1 ;wateenlekkerebanaan
But with more lines like that.
As you can see, there is always a char with a numerical value that can be a float (or double), and one line consists out of up to 8 of these char-number combinations. At the end of a line CAN be a comment that starts with ";" and this comment should be ignored.
Now what I want to write is something that opens this txt file, reads through it line by line. The up to 8 char-number combos from line 1 should go in command[0].c1 to command[0]v8, if there are less than 8 combos on the first line the missing ones get replaced by ''v'', 0. Then the ones from the second line go to command[1].c1 to command[1]v8, and so on until the last line was reached. By c1 I mean char 1 (you know, the first char on that line) and v8 = the 8th numerical value on that line (if there is a 8th one)
How could I do this???? I already have difficulties with recognising a line... :/
This is for a sort of emulator test and I want it to read commands from a txt file, now I have to enter commands in the code all the time, reading them from a file is cooler.
Thanks.