I am trying to open a file using a C function, but it says that it cannot access some memory location.
.data
filename: .asciz "some.bmp"
write: .asciz "wb"
.global main
main:
mov filename , %rdi # pass filename to rdi
mov write , %rsi # pass opening mode to rsi
call fopen # call fopen - seg faults
mov $0 , %rdi
call exit
I want to use C functions for educational purposes, I know I can open the file using syscalls.