Hi guys,
I am trying to write a code to read from a .dat file and then store its
contents in an array of word format so that it can be used in a another
funciton. But have no clue how to go about it can cany one help. The contents
are in the following format.

0A, 78
2B, 93
03, FE

// Skip the line when starts with double forward slashes
00, 10
04, 40
// Skip the line when starts with double forward slashes
// 56, A0

23, 1F
..can any one help !!

5 Years
Discussion Span
Last Post by zoomblue2000

are those hex values? Are you certain there is a comma between words? e.x. 0010 and 0440? One way to do it if with int ival; fscanf(%x", &ival);


Yes they are all hex values.
Hex followed by a coma followed by a space and then a hex value
. Can you help .
Thank you


And I am trying to read and store these hex values In two word arrays and use them in a function .


The Dragon gave you a major clue. Try reading about fscanf() and try some things. Testing is the best way to learn.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.