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
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: 3170
Location: Denmark
f0dder
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 Visit poster's website Reply with quote
coconut



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



Joined: 14 Jul 2004
Posts: 21
djca
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
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: 3170
Location: Denmark
f0dder
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 Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.