I am trying to read some info from a file. The text in the file in saved in the following format:
[String]TAB[Hex Number]TAB[Integer]TAB[Float]
Blahbllah Blahlahhhuhuhuhuh 3060 8 0.987676
Hhuhujinjhjbgjvgbj 6788 4 3.22245
Ghub Blahuahu Blhauhi Bujoj D011 4 7.8889
All I am trying to do is assign the numbers to variables - one hex, one int and one double.
Here are my problems:
- I am using fgets to get each line of the file and it just eliminates all TAB spaces between words and numbers so line two of the above file looks like this in my buffer:
Hhuhujinjhjbgjvgbj678843.22245
- If I change the TABS to white spaces fgets works, but I have failed at trying to read just the numbers because the string part is variable in length and number of words.
How do I go about using fgets with TABS and sscanf to read just the numbers?
I tried using every function mentioned in this: http://docs.roxen.com/pike/7.0/tutorial/strings/sscanf