Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the " > " character 1

Status
Not open for further replies.

magicme

Technical User
Jun 11, 2003
22
US
hello
i have a VB6 / gawk interface question.

running gawk in a DOS window allows you to redirect output to a file using the " > " symbol. my gawk script works fine when run in a command line window, using > to redirect output to a file.

i wrote a VB6 code to run the gawk script and it does run okay but will not redirect the output (it opens a command line window and writes to that) ..... gawk is interpreting the > symbol itself to be the name of a file rather than the redirect symbol (and of course the file doesnt exist)

since the command line execution works fine, this problem is some misunderstanding of the > symbol as generated by VB6 and interpreted by gawk. i am running MS-XP on a PC.

is there some other method to write " > " from VB6.
the folks over at the awk forum have helped up to this point, but i think this is now a VB6 issue (?)

i am in waters well over my head, so any advice is appreciated.

regards.

daveleo
 
I/O redirection using '>' is a feature of DOS and works in DOS environment only. VB's Shell function does not support it directly.

To make it work, you need to execute CMD.EXE and run your program as its child process so that it can use I/O redirection.

You can run a program as a child process of CMD.EXE using the /C switch. See the following command line.
[tt]
Shell "CMD.EXE /C your_program_file > your_output_file"
[/tt]
There are other methods as well which allow you to directly capture the output of a console program without redirecting to a file. Some involve Win32 API and some use Windows Scripting Host library.

See thread222-701371 and thread222-567909 for further details.
 
thanks Hypetia
that worked fine
being able to invoke gawk from a VB6 form will save me tons of time in the future.

daveleo

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top