i write this code to read from keyboard & write in a file
but it says "segmentation fault":((
plz answer i am failing:(((((((

comments are in farsi!!

section .data
fileName db '/home/fateme/Desktop/text.txt/',0
handler dd 10 ;baraye negah dashtane filedescriptor

section .bss
inputStr resb 100000

section .text
global _start:

mov eax,8 ; The syscall number for creat() (we already have the filename in eb
mov ebx,fileName
mov ecx,00644Q ; Read/write permissions in octal (rw_rw_rw_)
int 80h ; Call the kernel
; Now we have a file descriptor in eax
mov [handler],eax ;azin b bad filedescriptor dar handler ast

;read from keyboard
mov eax,3
mov ebx,0
mov ecx,inputStr
mov edx,100000
int 80h

;alan eax shamele tedade bytehaEye k khunde shode

;write to file
mov edx,eax
mov ebx,[handler]
mov ecx,inputStr
mov eax,4
int 80h

7 Years
Discussion Span
Last Post by SamY

what memory offset does your code start at? Maybe you reached a boundary limit and it wrapped around going to another area thus causing that error

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.