help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: reading hostname into a string var in Windows


From: John W. Eaton
Subject: RE: reading hostname into a string var in Windows
Date: Tue, 21 Sep 2010 03:41:49 -0400

On 20-Sep-2010, Tim Rueth wrote:

| > -----Original Message-----
| > From: Andy Buckle [mailto:address@hidden 
| > Sent: Monday, September 20, 2010 10:46 PM
| > To: address@hidden
| > Cc: address@hidden
| > Subject: Re: reading hostname into a string var in Windows
| > 
| > On Tue, Sep 21, 2010 at 6:37 AM, Tim Rueth <address@hidden> wrote:
| > > I know there's a simple answer to this question, I just 
| > can't figure 
| > > out what it is:  How do I read the hostname into a string 
| > variable in Octave?
| > > I'm on Windows Vista.
| > >
| > > Thanks,
| > >
| > > --Tim
| > 
| > [exitcode host]=system("echo %computername%")
| > 
| > I tested on XP. I think this should work on Vista.
| > 
| > --
| > /* andy buckle */
| > 
| 
| Yes, thanks, that works.  And now that I see how you did that, I also tried:
| 
| [exitcode host] = dos("hostname");
| 
| Which also worked.  And thanks, A Kelly, for:  getenv('COMPUTERNAME'), which
| also works.
| 
| I don't know if one of these three is more robust than the others or if it
| doesn't matter.  They all work on both Vista and Win7.

I just checked in the following change, so 3.4.x will have a
gethostname function:

  http://hg.savannah.gnu.org/hgweb/octave/rev/aca961a3f387

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]