08-25-2023, 02:07 PM
(This post was last modified: 08-25-2023, 10:46 PM by grymmjack.
Edit Reason: backtickify
)
(08-24-2023, 02:42 PM)GTC Wrote: My program generates 12 output files that then need to be sorted, and I'd rather do those sorts from within the app (via SHELL) than have to use SORT standalone from the command line afterwards.
Here's an example of how I'm calling it:
Sort_Command$ = "SORT " + "x.x" + " >> " + "y.y"
SHELL Sort_Command$
If I type that sort command on the command line I get y.y as a sorted version of x.x ... which is desired.
However when executed via SHELL a message flashes up in the output window (too fast to read before a blank window replaces it), and no sort occurs.
I have used SHELL previously with other commands and experienced no problems.
Is there a way of directing the contents of the output window to a file, so that I can read whatever is being shown on that?
Add a `SLEEP` to see the command before the shell exits maybe too, so you can see it.
Also in a real pinch `CTRL+S` will stop flow control and pause if you catch it in time, and `CTRL+Q` will resume. (I think that's the right order, I might have those flip-flopped).
Also @TerryRitchie has good advice about trying from batch file. If you still see the window shutting on you before you can read it in batch file you call your QB program from, use a `pause` there at the very end (same effect as QB64's `SLEEP` - will make you press a key - and even politely ask you to do so).
What you're asking for for redirection should be possible in QB64 - it's called `stdio` (where i = input, o = output) there is also a `stderr` which is an error stream for info/warning/failures. By default windows supports that. You see it above with your `>>` redirection in your `Sort_Command$`. That means to append the output of command `SORT x.x` to the file `y.y` -- if you want to get a fresh copy each time use 1 `>` instead, which will reset/erase the file vs. append it.
Hope this helps!