I am having trouble reading from a file that looks like this (indentation correct):
I  00400570,3
 S 00600a70,4
I  00400573,4
 M 7ff000388,4
This is what I have done:
FILE *input = fopen(trace_file,"r");
    char line_instruction;
    mem_addr memory_add; //mem_addr is typedef unsigned long int
    int size;
    int result;
    while(!feof(input)){
        fscanf(input, "%c %lx %d",&line_instruction, &memory_add, &size);
        if(line_instruction == 'I'){
            continue;
        }
        else if(line_instruction == 'S' || line_instruction == 'L'){
            ; //Add stuff
        }
        else{
            ; //Add Stuff   
        }
}
What I wanted to happen is that the letter goes to the variable "line_instructions", the hexadecimal to "memory_add" and the int at the end to "size." This is not what happens though. What would be the correct way/ better way to do this?
 
    