- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am developing a Win32 application with some basic command-line functionality; for example, the program has available a "--help" option that prints a brief help message then exits, without calling the GUI.
Clearly, using WRITE(UNIT=6,...) for writing to standard output does not work. When called from a regular WinXP "Command Prompt" terminal, e.g., "myprog.exe --help", nothing is printed in the terminal; however, when I redirect the output using
myprog.exe --help > help.out,
the file help.out is populated with the desired text. Furthermore, when executing "myprog --help" through a linux-emulator terminator (Cygwin), all works as expected.
Attempting to resolve this, I have tried using SetStdHandle; however, my implentation of this has been fruitless. Surely there is something fundamental here that I am missing.
CVF 6.6C on WinXP
Thanks a bunch,
Richard
Clearly, using WRITE(UNIT=6,...) for writing to standard output does not work. When called from a regular WinXP "Command Prompt" terminal, e.g., "myprog.exe --help", nothing is printed in the terminal; however, when I redirect the output using
myprog.exe --help > help.out,
the file help.out is populated with the desired text. Furthermore, when executing "myprog --help" through a linux-emulator terminator (Cygwin), all works as expected.
Attempting to resolve this, I have tried using SetStdHandle; however, my implentation of this has been fruitless. Surely there is something fundamental here that I am missing.
CVF 6.6C on WinXP
Thanks a bunch,
Richard
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Win32 apps don't have a console associated with them by default. You can create one by calling AllocConsole before you do the WRITE.
You may also want to consider using MessageBox to display the help text. Create a string with the text - embed CR-LF pairs as line separators, and terminate with a NUL.
You may also want to consider using MessageBox to display the help text. Create a string with the text - embed CR-LF pairs as line separators, and terminate with a NUL.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page