On Sep 20, 2006, at 9:52 AM, Tim Jones wrote:
May be an over simplification, but this ALWAYS works here (and it
works on Linux too):
Dim shUname As New Shell
Dim MyPlatform As String
shUname.Execute "uname -p"
If shUname.ErrorCode <> 0 Then
// Handle Error - is uname corrupt???
Else
MyPlatform = shUname.Result
End If
MyPlatform will either be "i386" or "powerpc".
You only need to run this test once per application run, so for an
optimization technique I would write the above code like this:
Function PlatformType() As String
Static myPlatform As String
Dim shUname As Shell
If (myPlatform.Len = 0) Then // not initialized
shUname = New Shell
shUname.Execute "uname -p"
If (shUname.ErrorCode <> 0) Then
// handle error - is uname corrupt???
Else
myPlatform = shUname.Result
End If
End If
Return myPlatform
End Function
This way you only create the Shell once per application launch...
after all the platform is not going to dynamically change. =)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>