Host Operating System?
BlitzMax Forums/BlitzMax Programming/Host Operating System?
| ||
Hi, Is there a cross-platform way of identifying the host operating system that your code is running upon? I've been using this, but need a little more detail to identify distribution/version (XP, Win7, Win8, Ubuntu, Debian, Mint etc) to include in fault reporting and OS-specific code. Cheers in advance... |
| ||
I have code in the code archives to determine the Windows version. I haven't updated it for Windows 8 but I'm sure you can modify it. [edit] Just updated it for Windows 8: http://www.blitzbasic.com/codearcs/codearcs.php?code=1978 |
| ||
Any idea how Windows 8.1 identifies itself? I'm assuming 6.3? |
| ||
6.3 apparently. Which is odd, because I would have assumed it to be a minor revision of 6.2. |
| ||
@Gfk: Cheers, thats just what I needed. ;) |
| ||
I've used the uname() function from utsname.h to create a linux equivalent but I am seeing a behaviour that is different from the docs. utsname.h defines SYS_NAMELEN as 256: #define _SYS_NAMELEN 256 struct utsname { char sysname[_SYS_NAMELEN]; /* Name of OS */ char nodename[_SYS_NAMELEN]; /* Name of this network node */ char release[_SYS_NAMELEN]; /* Release level */ char version[_SYS_NAMELEN]; /* Version level */ char machine[_SYS_NAMELEN]; /* Hardware type */ }; But when I coded this it didn't work. After some investigation of the results it appears that SYS_NAMELEN should be 65! The above code prints the following: SYSTEM: Linux NODE: linuxmint REVISION: 3.0.0-13-generic VERSION: #22-Ubuntu SMP Wed Nov 2 13:25:36 UTC 2011 MACHINE: i686 DOMAIN: (none) Any suggestions why SYS_NAMELEN should be different? |