I am in need of a way to read two files as input, and produce an output file. One file has a string in it that is a code ..... and the second file is a file containing a translation table for that code.
I need to read the first file, pull off the code from that file, then find the corresponding record containing that code in the second file, and then retrieve the description associated with that code from the second file.
I have been thinking of a few ways I could do this:
Option 1:
-----------
Read the second file (translations file) into a two dimensional array of structures, which contain multiple occurances of the following:
char code[3];
char description[20]
Then, read the first file, obtain the code, then perform a loop reading through the array of code/descriptions, until I find a match. Then I will have the correct description for my output file.
Option 2:
-----------
Perform a dynamic indexed read to the second file, whose key would be the code, and get the description that way.
As I am new to the C language, I am wondering which method you would think would be most beneficial and easy to code and easy to debug, etc. if there were a problem, and of course if anyone has an example, that would be helpful as well.
Thanks very much.