1. Re: STDout - dos
- Posted by gertie at visionsix.com Jan 17, 2003
- 331 views
On 16 Jan 2003, at 21:53, jbrown1050 at hotpop.com wrote: > > On Fri, Jan 17, 2003 at 12:51:36PM +1100, Patrick.Barnes at transgrid.com.au > wrote: > > > In a command-line interface (DOS, not linux) adding "> filename" > to the > end of your command redirects the output to a file instead. > > Is there any > other places you can redirect it? Ideally, I'd like > a system() command that > returns a string to the euphoria program. > > The redirection thing applies to Linux as well btw, jtlyk. > > There is like popen() for linux to do that sort of redirection you want, > for DOS it can be emulated. > > I've included at the very bottom of this message some sample code, which works > on ANY platform, that acts like system(), but returns the output. > > It merely redirects the output to a temp file, then reads the output from > the file into a string, and then deletes the temp file, however. > > (To the best of my knowledge thats the only way to do it for DOS. Even the > shell > uses temporary files to simulate command line pipes iirc.) There's any number of ways to store data in dos memory. You can fake a device driver entry to use it's space for a *short* bit of data. You can req an ems driver to page you increments of xms into the 640K-1meg space, which you can restore or delete or leave there or whatever. You can stuff the keybd buffer with a few bites and just gets() or read() it in when returning to the main program. I am sure Jiri could come up with a few dozen more methods. DRdos uses msg passing like windoze does, so they have a nice method too. If you know you will be using dos files to store data of any size, consider using a ramdrive in xms. Kat