I'm a having a problem with fprintf which I just can't grasp. Maybe you can find a solution to this problem.
You see, When I call fprintf it starts looping infinitely, for no good reason. I have no idea what's going here, so perhaps you can give me a hand.
String_int:
db 91; "["
db 37; "%"
db 115;"i"
db 93; "]"
db 0; "end_string"
w_IN_ASCII:
db 119; "w"
db 0; "end_string"
<SOME CODE>
mov rdi, FILE_LOCATION;
mov rsi, w_IN_ASCII;
call fopen;
mov r15, rax;
cmp r15, 0; (with this I can be sure it is not a NULL)
je .endProgram;
mov rdi, r15;
mov rsi, String_int;
mov rdx, TO_PRINT_LOCATION;
call fprintf; this is where my code dies
mov rdi, r15;
call fclose;
.endProgram:
ret