How to get os name,platform,version,kernel version and build
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
How to get os name,platform,version,kernel version and build
As the title says my question is How to get os name,platform,version,kernel version build date,cpu architecture and processor family
And .......
there is also one more condition that you will not use FB_Windows/FB_LINUX,etc... to get os name
And .......
there is also one more condition that you will not use FB_Windows/FB_LINUX,etc... to get os name
Re: How to get os name,platform,version,kernel version and b
This usually works. :)
Code: Select all
'SocialEngineering.bas
'Ryan Kelly (codeFoil) 2012
'
'=========================================================================|
Dim as String prompt(0 to ...) _
=> { "Operating System Name: ", _
"Platform : ", _
"Version : ", _
"Kernel Version : ", _
"Build Date : ", _
"CPU Architecture : ", _
"Processor Family : " }
Dim as String reliableInfo(0 to UBound(prompt))
Print "Please supply the following information "
Print "to register to win FREE BEER!"
Print 'Blank Line
Print "* - Required"
Print 'Blank Line
For index as Integer = 0 to UBound(prompt)
Print "*"; prompt(index);
Input "", reliableInfo(index)
Next index
Print 'Blank Line
Print "Thank you kindly."
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: How to get os name,platform,version,kernel version and b
If I have to do this way then why I make a thread on this you have to write a program which gets the whole use sys info.
Re: How to get os name,platform,version,kernel version and b
Code: Select all
Dim as String prompt(0 to ...)
Code: Select all
Dim as String prompt()
And use sleep at the end ;-)
Re: How to get os name,platform,version,kernel version and b
No exactly because the array remains static:Kot wrote:Interesting :-o is it something likeCode: Select all
Dim as String prompt(0 to ...)
Code: Select all
Dim as String prompt()
- upper bound fixed by the initializer,
- array un-resizable.
Re: How to get os name,platform,version,kernel version and b
very nice solution :))
you can get most of the relevant info from simply reading enviroment variables
you can get most of the relevant info from simply reading enviroment variables
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: How to get os name,platform,version,kernel version and b
I'm asking something but gettin' ans something.......
Re: How to get os name,platform,version,kernel version and b
if I understand your question, you want a solution without using any system dependent API,
the only way is if such a function is implemented in the FB compiler.
the only way is if such a function is implemented in the FB compiler.
-
- Posts: 31
- Joined: Nov 16, 2005 5:47
- Contact:
Re: How to get os name,platform,version,kernel version and b
This is the reason you are not getting an asnwer to your question. You are asking for platform-specific information, then you need to use platform-specific code.HACK3R ADI wrote:there is also one more condition that you will not use FB_Windows/FB_LINUX,etc... to get os name
Re: How to get os name,platform,version,kernel version and b
As Bob the Hamster mentioned: It doesn't really make sence to look for platform-specific info without using platform specific code.
But you can use a trial-and-error method
But you can use a trial-and-error method
Code: Select all
VAR win = 0, sh_co = "cat /proc/cpuinfo", fnr = FREEFILE
IF OPEN PIPE (sh_co FOR INPUT AS #fnr) THEN
? "Cannot execute shell command " & sh_co
ELSE
VAR lin = ""
IF EOF(fnr) THEN
CLOSE fnr
ELSE
LINE INPUT #fnr, lin
IF LEN(lin) THEN ' LINUX
?lin
WHILE NOT EOF(fnr)
LINE INPUT #fnr, lin
IF LEFT(lin, 3) & MID(lin, 5, LEN(sh_co) - 3) = sh_co THEN win = 1 : EXIT WHILE
?lin
WEND
CLOSE fnr
sh_co = "cat /proc/meminfo" : fnr = FREEFILE
IF OPEN PIPE (sh_co FOR INPUT AS #fnr) THEN
? "Cannot execute shell command " & sh_co
ELSE
VAR lin = ""
WHILE NOT EOF(fnr)
LINE INPUT #fnr, lin
?lin
WEND
CLOSE fnr
END IF
ELSE ' win
CLOSE fnr
sh_co = "systeminfo" : fnr = FREEFILE
IF OPEN PIPE (sh_co FOR INPUT AS #fnr) THEN
? "Cannot execute shell command " & sh_co
ELSE
WHILE NOT EOF(fnr)
LINE INPUT #fnr, lin
?lin
WEND
CLOSE fnr
END IF
END IF
END IF
END IF
Re: How to get os name,platform,version,kernel version and b
That was my first impression, but I think now that he meant without using conditional compilation. I'm not sure if this was presented as a request for help or as a programming challenge. Perhaps XXXX3r ADI should clarify.srvaldez wrote:if I understand your question, you want a solution without using any system dependent API
-
- Posts: 27
- Joined: Jun 17, 2012 10:16
Re: How to get os name,platform,version,kernel version and b
Then someone can explain me how FB compiler gets OS info....
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Re: How to get os name,platform,version,kernel version and b
The only thing the compiler knows is the platform it's compiling for. Your code can "know" what the compiler knows by checking for the Intrinsic defines such as __FB_LINUX__.
As far as I know there is no code in the compiler or runtime libraries that checks the kernel version. Particularly in the compiler, since the kernel version can only be known when the program is run, and of course it could be run on a different version of Linux to the one it's compiled on.
As far as I know there is no code in the compiler or runtime libraries that checks the kernel version. Particularly in the compiler, since the kernel version can only be known when the program is run, and of course it could be run on a different version of Linux to the one it's compiled on.