1. Another feature request (was 'crash_file')
- Posted by Greg Haberek <ghaberek at gmail.com> Oct 29, 2004
- 452 views
What I'd like to see is the ability to pass multiple file handles to output routines, puts(), print(), etc. So I could print information to a file and the screen at the same time. Take this for example:
constant debug = 1 -- set to 1 to send debug information to a file object out out = 1 -- send to screen if debug then out &= open("debug.out", "w") -- send to debug.out too end if -- just do this: puts(out, "information") -- only one call to puts! -- insted of this: -- puts(1, "information") -- puts(out, "information") if debug then close( out[2] ) end if
~Greg
if good( idea ) then my += 0.02 -- two more cents else blame( too_much_caffiene & RedBull ) end if
On Fri, 29 Oct 2004 07:33:13 -0700, Bernie Ryan <guest at rapideuphoria.com> wrote: > > posted by: Bernie Ryan <xotron at bluefrog.com> > > > Robert Craig wrote: > > > > Bernard Ryan wrote: > > > Why don't you return a file number when a user > > > uses crash_file() then a user could add information > > > to file for trouble shooting purposes as he runs > > > through their program's code. > > > > I think having a separate file is better. > > > > Using trace(3), I have, on occasion, written extra debug > > information to "ctrace.out". > > Since ctrace.out is flushed after each statement, you can > > printf() some values into it, and they will appear between > > the appropriate statements in that file. You just have > > to open it for append, mode "a", and then flush() it. > > I made a little routine to do that. > > > > Regards, > > Rob Craig > > Rapid Deployment Software > > > But how do i get access to the file handle ? > > Bernie > > My files in archive: > w32engin.ew mixedlib.e eu_engin.e win32eru.ew > > Can be downloaded here: > > http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan > > > > >
2. Re: Another feature request (was 'crash_file')
- Posted by CoJaBo <cojabo at suscom.net> Oct 29, 2004
- 444 views
- Last edited Oct 30, 2004
This is actually quite easy to do yourself, this example adds this to puts, but you can modify other routines (like flush()) too:
without warning procedure oldPuts(integer f,sequence s) puts(f,s) end procedure procedure puts(sequence f,sequence s) for o=1 to length(f) do oldPuts(f[o],s) end for end procedure --test constant file=open("test","wb") puts({file,1},"Testing...")
Greg Haberek wrote: > > What I'd like to see is the ability to pass multiple file handles to > output routines, puts(), print(), etc. So I could print information to > a file and the screen at the same time. Take this for example: > > }}} <eucode> > constant debug = 1 -- set to 1 to send debug information to a file > > object out > out = 1 -- send to screen > > if debug then > out &= open("debug.out", "w") -- send to debug.out too > end if > > -- just do this: > puts(out, "information") -- only one call to puts! > > -- insted of this: > -- puts(1, "information") > -- puts(out, "information") > > if debug then > close( out[2] ) > end if > > </eucode> {{{ > > ~Greg > }}} <eucode> > if good( idea ) then > my += 0.02 -- two more cents > else > blame( too_much_caffiene & RedBull ) > end if > </eucode> {{{ > > > On Fri, 29 Oct 2004 07:33:13 -0700, Bernie Ryan <guest at rapideuphoria.com> > wrote: > > > > posted by: Bernie Ryan <xotron at bluefrog.com> > > > > > > Robert Craig wrote: > > > > > > Bernard Ryan wrote: > > > > Why don't you return a file number when a user > > > > uses crash_file() then a user could add information > > > > to file for trouble shooting purposes as he runs > > > > through their program's code. > > > > > > I think having a separate file is better. > > > > > > Using trace(3), I have, on occasion, written extra debug > > > information to "ctrace.out". > > > Since ctrace.out is flushed after each statement, you can > > > printf() some values into it, and they will appear between > > > the appropriate statements in that file. You just have > > > to open it for append, mode "a", and then flush() it. > > > I made a little routine to do that. > > > > > > Regards, > > > Rob Craig > > > Rapid Deployment Software > > > > > > But how do i get access to the file handle ? > > > > Bernie > > > > My files in archive: > > w32engin.ew mixedlib.e eu_engin.e win32eru.ew > > > > Can be downloaded here: > > <a > > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a> > > > >