PureBasic Forum
https://www.purebasic.fr/english/

ComputerName() returns ComputerName.Router
https://www.purebasic.fr/english/viewtopic.php?f=19&t=72837
Page 1 of 1

Author:  Lebostein [ Fri May 17, 2019 7:16 am ]
Post subject:  ComputerName() returns ComputerName.Router

In my case ComputerName() returns "MacBook.local" on work and "MacBook.Speedport_Router_xyz" at home.

Is this a bug or an undocumented feature?

Author:  wombats [ Fri May 17, 2019 10:06 pm ]
Post subject:  Re: ComputerName() returns ComputerName.Router

I don't know about PureBasic's function, but you can get a better version like this:
Code:
host = CocoaMessage(0, 0, "NSHost currentHost")

hostName = CocoaMessage(0, host, "name")
string = CocoaMessage(0, hostName, "UTF8String")
Debug PeekS(string, -1, #PB_UTF8)

localisedName = CocoaMessage(0, host, "localizedName")
string = CocoaMessage(0, localisedName, "UTF8String")
Debug PeekS(string, -1, #PB_UTF8)

Debug ComputerName()

Author:  mk-soft [ Sat May 18, 2019 1:05 am ]
Post subject:  Re: ComputerName() returns ComputerName.Router

Thanks

The Purebasic version returns the wrong machine name when virtual machines are running.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/