VOGONS


4DOS Color Prompt?

Topic actions

Reply 20 of 22, by Dacobi

User metadata
Rank Newbie
Rank
Newbie

Thanks for the answer.

I actually did something like this with pipes many many years ago.
I made a GUI program to run a cli cdrom burner tools in Linux.
But here I only piped the output and then used system() for the cli command.

So I think I understand the windows example you linked.
The problem seems to be to find docs regarding this process in DOS/C
Everything on Google is Windows oriented.

Reply 22 of 22, by spiroyster

User metadata
Rank Oldbie
Rank
Oldbie

Yeah you might need to find an old book. Standard streams are a unix thing from a looooong time ago. If anything, in MSDOS, it's an afterthought. I don't know at what point support was added to MSDOS, but there stands a good chance that it is later DOS. Someone else may know.

Only the last code example is DOS specific. Change the include from #include <cstdlib.h> to #include <stdlib.h>, and the command syntax from 'dir' to 'ls' and it will work in nix. There are many examples of this for unix, and there are subtle behavioural differences, although most of the concept is the same. You would need to use fork() instead or CreateProcess(). I don't really use them in programs, only in scripts, but I learned from the unix way as opposed to the Windows way, and I don't remember the transition being too difficult to Windows redirection. Good luck.