The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Missing LabTalk variables and Lt_get_var

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 10/11/2006 : 5:00:30 PM
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: Win2000

Hi,

With LabTalk I'll routinely check if a variable has been set eg by
if(setvar!=0/0) {...}
This is really useful!

With OC though I come across a problem..

The following code illustrates what I would like to use :

void CheckVar(string strvar)
{
double outdouble;
LT_get_var(strvar, &outdouble);
out_double("Val : =", outdouble);
}


If I now check a variable which hasn't been set eg
CheckVar(NotSet) The value 0 is displayed, yet in LabTalk CheckVar=-- ie missing value.

To get the CheckVar function to behave as expected I have to set NotSet=0/0 first then the value '--' ie NANUM is correctly displayed. This sortof defeats the purpose and I'm not happy with what's going on. Can someone please explain and say if it's a bug or not?

Cheers,

Pete

2   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 10/18/2006 : 10:29:32 AM
Hi Deanna,

Belated thanks - this works for me!

Cheers,

Pete



Deanna Posted - 10/11/2006 : 10:18:41 PM
Hi, Peter.

The return value of LT_get_var() function might work better in checking if a Labtalk variable has been set.

It is explained in the file utilities.h that the return value will be TRUE if lpcszLabTalkVarName is a LabTalk variable, and FALSE if it is not for the function:
BOOL LT_get_var(LPCSTR lpcszLabTalkVarName, double * lpdbResult); // Get LabTalk variable value


I think the code can be rewritten as:

void CheckVar(string strvar)
{
double outdouble;
bool bRet = LT_get_var(strvar, &outdouble);
if (bRet) out_double("Val : =", outdouble);
else out_str("This variable has not been set");
}



Deanna
OriginLab Technical Services

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000