Highlighted
Outstanding Contributor.
Outstanding Contributor.
329 views

ctrx_obj_get_info() stepping on other declared variables? ...

Jump to solution

LR 12.5, working on a Citrix script.

I'm storing a value in a VTS table for the environment to use, then grabbibg it at runtime. That seems to work fine.

And the script does a few different things based on this value.. For the most part that works fine.

I'm declaring that value like this:
    char szLocalEnvironment[3];

I set a value to it like this:
    strcpy (szLocalEnvironment, szEnvironment);
    lr_log_message("szLocalEnvironment is =%s\n", szLocalEnvironment);

Let's say the two possible values for the variable are "ABC" and "DEF".

The problem is after I call this function:
ctrx_obj_get_info("NULL=snapshot_11", 97, 587, TEXT, object_value_buffer, CTRX_LAST);

At this point the value of 'object_value_buffer' is correct:
    "Ready...Last Claim Accepted: LR1234567890"

But when I then check the value of szLocalEnvironment, it has a value like this:
   ABCMyApp - Medical Claims Processing - DAVIS, EARL

For some reason the current window title is getting appended to the end of my 'szLocalEnvironment' variable.

Any idea why this is happening? Am I not declaring the variable 'szLocalEnvironment' properly? I realize that C strings are null-terminated, but I can't quite figure out what's happening here.

I'm checking the value of the variable immediatelly before and after the ctrx_obj_get_info() so it's definitely happening there.

Thanks,
Chris

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: ctrx_obj_get_info() stepping on other declared variables? ...

Jump to solution

Think I found it.

This:

char szLocalEnvironment[3];

Should be this:

char szLocalEnvironment[4];

Embarrassed to say I forgot to leave space for the null.

View solution in original post

0 Likes
1 Reply
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: ctrx_obj_get_info() stepping on other declared variables? ...

Jump to solution

Think I found it.

This:

char szLocalEnvironment[3];

Should be this:

char szLocalEnvironment[4];

Embarrassed to say I forgot to leave space for the null.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.