hai,
I wish to append a file at the end of file.
but this is not working.
please help me
%macro mymac 4
mov eax,%1
mov ebx,%2
mov ecx,%3
mov edx,%4
int 80h
%endmacro
section .data
msg1 db 'enter filename : '
ml1 equ $-msg1
msg2 db 'file contents are : ',10
ml2 equ $-msg2
msg3 db 'File not exists !!! ',10
ml3 equ $-msg3
info db 'hello'
l equ $-info
;fname db 'abc.txt',0
section .bss
fname resb 50
flen resb 1
buff resb 20
bsize resb 2
fd resb 1
section .text
global _start
_start:
mymac 4,1,msg1,ml1
mymac 3,0,fname,50
mov [flen],eax
dec eax
mov byte [fname+eax],0
mymac 5,fname,2,0777
mov [fd], byte eax
cmp eax,0
jg proceed
mymac 4,1,msg3,ml3
jmp exit
proceed:
mymac 3,[fd],buff,20
dec eax
mov [bsize], byte eax
mymac 19,[fd],0,2
mymac 4,[fd],info,l
mymac 6,[fd],0,0
mymac 4,1,msg2,ml2
mymac 4,1,buff,bsize
exit: mymac 1,0,0,0