for (i=0; memory[i]!=0xc0;i+=2) {
This is just plain nasty, I think a while loop would work better instead of a for loop.
If you want to read in two separate values, try reading two characters into a string twice per line and then converting it to a hex. Assign the first hex to a variable and do the same thing with the second set of characters.
And you can tighten up your code a bit where you open the file
Code:
FILE *code_file;
if((code_file=fopen("test.b", "r+"))==0){
printf("Unable to open file!");
exit(1);
}