Page 1 of 1

Console redirection crashes Hello World

Posted: Thu May 22, 2003 9:57 pm
by iancrt
hi,
I just bought pb as it seems to have good console capability, but just hit a problem I hoping there is a solution to.....
Nice simple classic prog:

Code: Select all

OpenConsole()
  PrintN("Hello World")
CloseConsole()
compile as console app, all cpu and tried with/without NT compliance as Helloworld.exe
Run the program from the command line and we get the expected 'Hello World'. problem starts when I try to use console redirection. Run the command

Code: Select all

helloworld >c:\daft
and I expected to get the file c:\daft containing 'Hello World', instead XP Pro shuts down the executable. Has anyone else had this problem? have I missed something in my code? Is there a workaround?

Better mention, doing all this on AMD 1700+ & Windows XP Professional

Posted: Fri May 23, 2003 6:40 am
by WolfgangS
Hi !
Windows immediately closes the console ...

try:

Code: Select all

OpenConsole() 
  PrintN("Hello World") 
  delay(1000)
CloseConsole() 
MFG
WolfgangS

Posted: Fri May 23, 2003 7:56 am
by iancrt
hi,

thanks for that, doesn't work though. I'm calling the app from an existing console so its not closing. tried setting the delay quite large (100000) still got the same problem. I put the delay before printn() and the program took longer to crash. tried adding inkey() before printn and it waits for a key before crashing, So I think its specifically PrintN() thats causing the crash. Any other ideas?

ian

Posted: Fri May 23, 2003 8:50 am
by Fred
I will investigate all the console stuff soon, as it seems to be a bit strange.

Thanks

Posted: Tue May 27, 2003 1:42 pm
by iancrt
Thanks, I will watch for any updates.
I'm porting a suite of BCX,QBasic and PowerBasic Dos/Console Apps, so far only the redirection being a major problem.