Capturing SHELL Output

I was just curious if you could redirect the output a SHELL command gives you into an array of some sort? No reason, just curiousity.

Comments

  • : I was just curious if you could redirect the output a SHELL command gives you into an array of some sort? No reason, just curiousity.
    :

    Not without some extensive work in memory, but you can do this for any program/command that uses stdout (standard output):

    Shell "command > filename.txt"
    Open "filename.txt" For Input As 1

    The redirect character ( > ) sends the program's output to a file instead of the screen. I believe this works with any DOS command and with all the DOS utils that come with DOS/Windows.
  • : I was just curious if you could redirect the output a SHELL command gives you into an array of some sort? No reason, just curiousity.
    :
    : I was just curious if you could redirect the output a SHELL command gives you into an array of some sort? No reason, just curiousity.
    :
    Hi!

    One way is to re-direct the output of the command to a file, then process the file. So, If you want info on a directory, you can shell this command:

    DIR > C:DIR.TXT

    Another way is to write a C or Assembly program that accepts standard input, and process it the way you wat. Then you could pipe the output of the command to your program:

    DIR | C:MyProgram.exe




    Melissa




    [purple]Melissa[/purple]

  • : I was just curious if you could redirect the output a SHELL command gives you into an array of some sort? No reason, just curiousity.
    :

    Ahh, I see. The file idea sounds [italic]much[/italic] better than poking around in memory.

    Thank you both.
  • I found once a greate tutorial on qbasic, there is a command in qbasic to get the output and to return a value supported only by QB45 (not listed in the help file). I lost the tutorial few months ago so I can't tell you anything else.

    Try to search your self. The tutorial was done in qb and compiled to exe, search the web for qb tutorials and mabe you will find it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories