The function then returns the number of data bytes found in the hex file. This function reads the hex file, parses it, extracting the data and placing them into the the uint8_t array based on the data's address found in the hexfile. 23: We pass hex_file_to_array a file pointer and pointer to an an array.We pass it the file we wish to open and it returns the opened file. We are setting up to only read the file in binary. 20: We pass the pointer to the data stream to the open_file function.17: Here we create a pointer to a file data stream.I've set it arbitrarily, but it will need to be large enough for the amount of data to be extracted from the hex file. 11: Declare a unsigned array for the data.6: Let's check the number of arguments passed in by the user.HEX_array_size = hex_file_to_array(hex_file, HEX_array) Open file using command-line info for reading. If the user fails to give us two arguments yell at him.įprintf ( stderr, 'Usage: %s \n', argv )