Richard(s), DOS and Windows are no different in this regard. stdin, stdout and stderr have been a part of it since at least DOS version 2.1 (I've never used an earlier one). And all this piping works in them too.
Maarten > stdout (stdin and stderr) are an integral part of stdio.h, so it's as much a > C-ism as a Unix-ism. > > I don't know how the Windows environment would cope with this, but under Unix > file-descriptor 0 is stdin, descriptor 1 is stdout, and 2 is stderr, and > these are automatically opened before the execution of main() if one includes > stdio.h. I should stress that I'm talking about PC-type processors now, > rather than the SDCC device set - the underlying assumptions about the > operating system don't exist for small devices, so stdio.h and its > accompanying libraries would probably not be meaningful for a PIC or a Z80 or > whatever. > > In Unix, suppose one were running a program called 'blinkey' - a nice example > people seem to use... > > shell$ blinkey | more > > This would pipe the stdout from 'blinkey' through to stdin of 'more'. > Anything > blinkey wrote to stderr would appear on the screen, but if this was too much > to cope with one could do this... > > shell$ blinkey 2> errors.txt > > The above means to redirect file descriptor 2 (stderr) to the errors.txt file. > > Similarly, the standard input can be pulled from a file, like this... > > shell$ blinkey < blinkey_input.txt > > And then one can get smart and combine these to do all kinds of crazy things! > > I *believe* Windows/DOS can do the standard input and output bits in similar > fashion, but I have never had occasion to try it - I'm a dyed-in-the-wool > Unix (Linux) nerd, you might gather. I don't know how Windows copes with > descriptor 2 (stderr) if at all. > > On Saturday 30 August 2008 17:41:38 Richard Erlacher wrote: > > Well, that's exactly the mechanism I mentioned ... I'm not surprised it has > > a name ... but -stdout ... ??? That sounds like *nix. > > > > regards, > > > > Richard Erlacher > > > > ----- Original Message ----- > <snip> > > -- > Richard. > PGP Key-id: 0x5AB3D350 > > A reactionary is a man whose political opinions always manage to keep > up with yesterday. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user