Re: Forth stdin and stdout




To build a DOS version, run win32for.exe as normal and run the
following;

also vimage
cui to exetype
fsave w32fdos.exe
bye

This will create an executable called w32fdos.exe, which you can run
as usual. It will open a DOS console and a window. To create the
handles to the console;

s" CONOUT$" w/o create-file drop to stdout
s" CONIN$" r/o create-file drop to stdin

Now you can use stdin and stdout as usual with read-file and write-
file, or use redirects and pipes from the command line.

Parameters to Windows calls in Win32Forth are passed in reverse order.
Your printf example would be

1234 z" Number %d" call printf


What you mentioned including the printdf example worked for me.
However, I could not make the example of fprintf to work. Could you
show how to translate the following statement to Win32forth?

fprintf(stdout,"Number: %d", 1234);

Thanks!
.



Relevant Pages

  • Re: Forth stdin and stdout
    ... It will open a DOS console and a window. ... Anyhow, Win32Forth ... stack representation ...
    (comp.lang.forth)
  • Re: Forth stdin and stdout
    ... It will open a DOS console and a window. ... terminated C type strings. ... "call printf" seems to work just fine. ...
    (comp.lang.forth)
  • Re: basics
    ... As for using printf rather than puts, ... console window, run the program, and then close the window before you can ... Stupid stupid stupid. ... Just teach them how to use a console ...
    (comp.lang.c)
  • Re: Use of colors
    ... the full console window in win32forth with FGBG! ... It's not really the primary output device for Win32Forth, ... Use a small window with the always on top attribute to display ... Use a modified console status bar to display the Email state, ...
    (comp.lang.forth)
  • Re: StartupInfo in CreateProcess for ShowWindow
    ... Yeah, CreateFlag is it. ... I make CREATE_NO_WINDOW and the window is not shown. ... So CreateProcess opens the DOS console ... Your Win32 app is expected to create its own window. ...
    (microsoft.public.vc.language)