Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » More Unicode questions
Re: More Unicode questions [message #21536 is a reply to message #21535] Mon, 25 May 2009 14:49 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1405
Registered: September 2007
Ultimate Contributor
And more fixes. Tested under XP/Vista. Don't have 95/98.

String GetComputerName()
{
#if defined(PLATFORM_WIN32)
	if (IsWinNT()) {
		wchar temp[256];
		*temp = 0;
		dword w = 255;
		::GetComputerNameW(temp, &w);
		return WString(temp).ToString();
	}
	else
	{
		char temp[256];
		*temp = 0;
		dword w = 255;
		::GetComputerNameA(temp, &w);
		return FromSystemCharset(temp);
	}
#else
	char temp[256];
	*temp = 0;
	gethostname(temp, sizeof(temp));
	return FromSystemCharset(temp);
#endif
}

String GetUserName()
{
#if defined(PLATFORM_WIN32)
	if (IsWinNT()) {
		wchar temp[256];
		*temp = 0;
		dword w = 255;
		::GetUserNameW(temp, &w);
		return WString(temp).ToString();
	}
	else {
		char temp[256];
		*temp = 0;
		dword w = 255;
		::GetUserNameA(temp, &w);
		return FromSystemCharset(temp);
	}
#else
	return Nvl(GetEnv("USER"), "boot");
#endif
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cross Compile HowTo?
Next Topic: Problem installing upp on ubuntu
Goto Forum:
  


Current Time: Sun Jun 16 00:02:25 CEST 2024

Total time taken to generate the page: 0.01652 seconds