0

I want to create a program that creates, opens, edits and then closes a file, the purpose is to write 'hello' to the file, but instead of editing the file, it creates me a file called 'tfile.txt' and then edits the name to 'tfile.txtHello'$'001'. Please help.

section .data
    idfile db '/home/alvaro/nasm/tfile.txt'
    msgfile db 'Hello'
    lonmsg equ $-msgfile
section .text
    global _start
_start:
    mov eax, 8
    mov ebx, idfile
    mov ecx, 777o   
    int 0x80

_openfile:
    mov eax, 5
    mov ebx, [idfile]
    mov ecx, 777o
    int 0x80

_editfile:
    mov eax, 4
    mov ebx, [idfile]
    mov ecx, [msgfile]
    mov edx, lonmsg
    int 0x80

_closefile:
    mov eax, 6
    mov ebx, [idfile]
    int 0x80
    
_finalize:
    mov eax, 1
    mov ebx, 0
    int 0x80
Michael
  • 57,169
  • 9
  • 80
  • 125

0 Answers0