Posted: Sat Dec 28, 2002 9:36 pm
Restored from previous forum. Originally posted by pbdep.
Hi,
Because it seems PB v3.30 does have RunProgram defined but is
not executed you could workout with the following example I
mixed it in 2 minutes.. Im lazy but its usefull. If you want the
Arguments and Environment settings You have to point them out
to and Array and end with a Null-byte. Hope its usefull. Pbdep.
;------------------------------------------------------
; execute program
;------------------------------------------------------
; You can extent by passing Environment and Arguments
; for returned errors see also /errno.h
;------------------------------------------------------
Procedure NewRunProgram(fname$)
FILENAME.s = FNAME$+chr(0)
ENVP.s = chr(0)
ARGV.s = chr(0)
RESULT = 0
MOV EAX,11 ; execve
MOV EBX,FILENAME ; filename
MOV ECX,ARGV ; arguments
MOV EDX,ENVP ; environment
INT 0X80 ; syscall
MOV RESULT,EAX ; result, if errors
ProcedureReturn RESULT
EndProcedure
printn (str( NewRunprogram("./file") ))
;------------------------------------------------------
Hi,
Because it seems PB v3.30 does have RunProgram defined but is
not executed you could workout with the following example I
mixed it in 2 minutes.. Im lazy but its usefull. If you want the
Arguments and Environment settings You have to point them out
to and Array and end with a Null-byte. Hope its usefull. Pbdep.
;------------------------------------------------------
; execute program
;------------------------------------------------------
; You can extent by passing Environment and Arguments
; for returned errors see also /errno.h
;------------------------------------------------------
Procedure NewRunProgram(fname$)
FILENAME.s = FNAME$+chr(0)
ENVP.s = chr(0)
ARGV.s = chr(0)
RESULT = 0
MOV EAX,11 ; execve
MOV EBX,FILENAME ; filename
MOV ECX,ARGV ; arguments
MOV EDX,ENVP ; environment
INT 0X80 ; syscall
MOV RESULT,EAX ; result, if errors
ProcedureReturn RESULT
EndProcedure
printn (str( NewRunprogram("./file") ))
;------------------------------------------------------