flat assembler
Message board for the users of flat assembler.

Index > Windows > STDIN/STDOUT redirection?

Author
Thread Post new topic Reply to topic
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 19 Jul 2004, 22:57
Is it possible to redirect stdin and stdout for a Windows Console application? For example could I do:

Code:
   rf <somefile.rf
    

_________________
Charles Childers, Programmer
Post 19 Jul 2004, 22:57
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 20 Jul 2004, 01:11
indeed you can. If you're on NT, be sure to use cmd.exe instead of command.com. You should be able to pipe binary files too, at least on NT. It can be done programatically with CreateProcess too, have a look at the STARTUPINFO structure.
Post 20 Jul 2004, 01:11
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 20 Jul 2004, 04:20
Post 20 Jul 2004, 04:20
View user's profile Send private message Reply with quote
djca



Joined: 14 Jul 2004
Posts: 21
djca 20 Jul 2004, 08:16
Actually there is Iczelion tutorial about pipes (tut. N21). I test it but the pipe works with console apps and not with plain dos com files
Post 20 Jul 2004, 08:16
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 18 Oct 2004, 16:49
I finally found a way to do what I want without causing major design headaches Smile

Code:
; Original Lines
  invoke WriteConsole, [StdOut], emit_buffer, 1, 0, 0
 invoke ReadConsole, [StdIn], emit_buffer, 1, written_buffer, 0
; Change to:
  invoke WriteFile, [StdOut], emit_buffer, 1, 0, 0
    invoke ReadFile, [StdIn], emit_buffer, 1, written_buffer, 0
    


By making the above change, my console apps can now have I/O redirected from the command line. No need for child processes, pipes, etc Smile
Post 18 Oct 2004, 16:49
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 18 Oct 2004, 18:32
Aha, so read/writeconsole don't handle redirection? - interesting! Never used those APIs, so didn't know it was something that simple Smile
Post 18 Oct 2004, 18:32
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.