This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: StrToNum is broken?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 05, 2011
06:39 PM
StrToNum is broken?
I have some code to check the sub-version number of the installed Java by stipping the number from the end of the install path (retrieved from the registry). However, the StrToNum function is returning zero. Here is the code:
The result is:
C:\Program Files (x86)\Java\jdk1.6.0_26
jdk1.6.0_26
26
0
Obviously, the StrToNum function is failing, but I can't tell why.
STRING szJavaHome, szJavaDir, szJavaVer;
NUMBER nJavaVer;
BOOL bGoodJava;
if (StrLength(szJavaHome) > 1) then
if (ParsePath(szJavaDir,szJavaHome,FILENAME) = 0) then
if (StrSub(szJavaVer,szJavaDir,StrFind(szJavaDir,'_')+1,2) = 0) then
if (StrToNum(nJavaVer,szJavaVer) = 0) then
if (nJavaVer >= 26) then
bGoodJava = TRUE;
endif;
endif;
endif;
endif;
SprintfBox(INFORMATION,"","%s\n%s\n%s\n%ld",szJavaHome,szJavaDir,szJavaVer,nJavaVer);
The result is:
C:\Program Files (x86)\Java\jdk1.6.0_26
jdk1.6.0_26
26
0
Obviously, the StrToNum function is failing, but I can't tell why.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 05, 2011
08:02 PM
StrSub doesn't return 0 for success, so maybe the inner StrToNum just isn't being called?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 06, 2011
08:09 AM
Oops, teach me to read the documentation.
Guess that should be >0.
Thanks Robert.
Guess that should be >0.
Thanks Robert.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)