RE: STDout

new topic     » goto parent     » topic index » view thread      » older message » newer message

Oh, I see...

The main source of latency though is the time taken to do the pings... one at a
time.

I'll just do it with '>', because of the very different formats that a ping
output can take. I see, a '>>' appends to the file, rather than clearing it.

When I do a system() call, a dos box appears. When I do 1300 system calls, they
pop up sequentially of the course of an hour or so. Now this is particularly
irritating! Anyway to stop them appearing? There is nothing displayed in the
dosboxes, because any output is redirected to a file.

-----Original Message-----
From: 'jbrown1050 at hotpop.com' [mailto:jbrown1050 at hotpop.com]
To: Barnes Patrick
Subject: Re: STDout


On Mon, Jan 20, 2003 at 09:32:58AM +1100, Barnes Patrick wrote:
> I don't get it.
> 
> command line example?

--start of example

constant ping_addr = {...} --put your addrs in there, or maybe read from a file.

constant datafile = "12345678.123"

procedure system_r(sequence s)
	system(s&" >> "&datafile, 2)
end procedure

--ping them all at once.
for i = 1 to length(ping_addr) do
	system_r("ping "&ping_addr[i])
end for

integer h
h = open(datafile, "r")
--at this point, the output of all 1300 pings have been saved to file,
--so you can read it all at once.

--end of example

Is that simple enough for you?

> 
> -----Original Message-----
> From: 'jbrown1050 at hotpop.com' [mailto:jbrown1050 at hotpop.com]
> Sent: Monday, 20 January 2003 09:33
> To: Barnes Patrick
> Subject: Re: STDout
> 
> 
> On Mon, Jan 20, 2003 at 08:54:50AM +1100, Barnes Patrick wrote:
> > >>Use >> instead of >, and read it in once, instead of 1300 times.
> > 
> > I don't understand the use of >> as opposed to >. There are 1300 names to
> > ping, and each time I need to get the text from that ping returned to the
> > euphoria program.
> 
> Using '>>' lets you ping 1300 times, but read it in all at once.
> 
> That may not be signifcantly faster however, doing it in windows via pipes
> (Elliott tells me CreatePipe(), DuplicateHandle(), and CreateProcess() is
> the way to go, tho I know not the specifics) is the best method.
> 
> jbrown
> 
> > 
> > -----Original Message-----
> > From: jbrown1050 at hotpop.com [mailto:jbrown1050 at hotpop.com]
> > Sent: Friday, 17 January 2003 15:49
> > To: EUforum
> > Subject: Re: STDout
> > 
> > 
> > 
> > On Fri, Jan 17, 2003 at 03:12:05PM +1100, Patrick.Barnes at transgrid.com.au
> > wrote:
> > > 
> > > Hmm... I think that would be too slow.
> > > 
> > > I have to ping 1300 names, and for each record what the IP address
> > > resolves too, and whether the ping a) succeeds b)times out or c) does not resolve
> > > the IP address
> > > 
> > > Any alternative to piping the ping output into a file, and reading it 1300
> > > times?
> > > 
> > 
> > Use >> instead of >, and read it in once, instead of 1300 times.
> > 
> > However, using real pipes would be better. (I know how to do this for Linux,
> > but not windows, sry.)
> > 
> > jbrown
> > 
> > > 
> > > -----Original Message-----
> > > From: jbrown1050 at hotpop.com [mailto:jbrown1050 at hotpop.com]
> > > Sent: Friday, 17 January 2003 13:53
> > > To: EUforum
> > > Subject: Re: STDout
> > > 
> > > 
> > > 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.)
> > > 
> > > jbrown
> > > 
> > > > 
> > > > =======================
> > > > Patrick Barnes
> > > > Information Systems Group
> > > > 201 Elizabeth St, Sydney
> > > > Patrick.Barnes at transgrid.com.au
> > > > Ext: 91-3583
> > > > Ph:(02) 9284-3583
> > > > Mob: 0410 751 044
> > > > 
> > > > 
> > > > ***********************************************************************
> > > > 
> > > > 
> > > > ***********************************************************************
> > > > 
> > > > 
> > > > TOPICA - Start your own email discussion group. FREE!
> > > 
> > > ---the file
> > > --start comout.e
> > > -- command output
> > > -- emulates bash's `command` abilites.
<snip>

> > 
> > 
-- 
 /"\  ASCII ribbon
 \ /  campain against
  X   HTML e-mail and
 /*\  news and unneeded MIME



***********************************************************************




***********************************************************************

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu