Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .data
- filename: db 'testdir',7 ;name of the new dir
- string: db 'Hello',5 ;string to write to file..
- stringLen: equ $-string ;length of string
- textfile: db 'hello.txt',9 ;textfile to write string to..
- section .text
- global _start
- _start:
- ;Creating directory..
- mov eax, 39 ;mkdir sys-call
- mov ebx, filename ;copy filename into first arg of mkdir syscall
- mov ecx, 00644Q ;rw_rw_rw in octal
- int 80h ;call the kernel..
- ;cd to the created dir..
- ;ebx still contains the filename
- mov eax, 12 ;chdir syscall
- int 80h; ;now inside the create dir
- ;Create a file
- ;ecx still contains the perms in octal
- mov eax, 8
- mov ebx, textfile;
- ; Exit the prog..
- mov eax, 1;
- mov ebx, 0;
- int 80h;
Add Comment
Please, Sign In to add comment