I am attempting to delete or unlink a file. Unlink meaning delete, I think (from what I have read).
I read documentation and another documentation. They both said that unlinking takes in 1 argument. const char * pathname
.
I've done that, however, the file that I want to delete is not getting deleted. Does anyone know why? Here is my code:
global start
section .text
start:
;This is the deleting/unlinking part
mov rax, 0x2000010; unlinking
mov rdi, file ; contains path and the file. If you look down more in section .data you can see the file and path
syscall
;This part is not important: Its just exiting
mov rax, 0x2000001 ;Exiting
xor rdi, rdi
syscall
section .data
file: db "/Users/daniel.yoffe/desktop/assembly/CoolFile.txt", 0
I've also looked at an example in linux. It was just like this. Is there something that I have done wrong? Does unlinking even delete a file? Am I missing something maybe another argument?
Help would be appreciated.