I almost finished my "PB Interpreter", which allows me to write my whole websites in PureBasic.
I've got this console executable to be compiled and executed:
Code: Select all
OpenConsole()
PrintN("Content-Type: text/html")
PrintN("")
Print("Hello from PureBasic "+Str(Random(999)))output wrote:Content-Type: text/html
Hello from PureBasic 561
But when my interpreter tries to run the executable, an error occurs. I use this code:
Code: Select all
OpenConsole()
; other code
Define program=RunProgram(exe$, commandline$, "", #PB_Program_Open|#PB_Program_Read|PB_Program_Write)
Define *output, available
While ProgramRunning(program)
available=AvailableProgramOutput(program)
If available
*output=AllocateMemory(available)
If *output
ReadProgramData(program, *output, available)
; pass the output back to Apache by writing it to OUR stdout
WriteConsoleData(*output, available)
EndIf
EndIf
Delay(10)
WendWhat is going wrong here? I'm new to Linux/Unix, but I already got some basic knowledge, i. e. about pipes, stdin, stdout, stderr, bash/shell, etc.
I can also provide this executable so that you can download and run it on your machine for testing.
Oh yes, and my server is running with PB 4.30 and openSUSE 10.3.


