Tuesday, 20 August 2013

Assign numbers in a txt file to variables

Assign numbers in a txt file to variables

How do you assign an unknown substring (a Hex number) from a specific line
in a txt file?
I've written the code to identify the necessary line and I've been told to
use Regular Expressions (regex).
I don't know how to do that. Can it be done without regex?
This is an extract from an example txt file. I'm looking to get (and then
compare Value(2) and Value(3)) but I need the Hex numbers first.
Default(2) = 0x00
Value(2) = 0xE0A64F36
Desc(2) = calculated from application
Address(2) = 0x60
Page(2) = Sensor
Name(3) = ROM CRC32
Type(3) = u32
Default(3) = 0x00
Value(3) = 0xE0A64F36
Desc(3) = fix CRC from ROM

No comments:

Post a Comment