Highlighted
Absent Member.
Absent Member.
222 views

Whats wrong with string functions

Hi,
I need to concat a string and assign it to lrd_assign. This will just not work.

const char *str="";
str=(char*)malloc(1000);
str="ACI"+"{Saved_PolId}"+"000000001";
lr_output_message("String Formed:", str);
lr_save_string(str,"VerA");
lrd_assign(&VersionRef_D23342, "{VerA}", 0, 0, 0);
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

Re: Whats wrong with string functions

Please check the function strcat in the help.

Remember this is ansi C
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Whats wrong with string functions

Thanks for the reply.

The reference says:

Example: strcat
The following example uses strcat to append a backslash to the directory name, fullpath. It then appends filename to fullpath.

char fullpath[1024], * filename = "logfile.txt";

strcpy(fullpath, "c:\\tmp");

strcat(fullpath, "\\");

strcat(fullpath, filename);

lr_output_message ("Full path of file is %s", fullpath);

Output:
Action.c(9): Full path of file is c:\tmp\logfile.txt


In my case, the str variable holds correct value, but as soon as lrd_assign is used after lr_save_string; it breaks.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Whats wrong with string functions

Its probably not a null termainated string. Try lr_eval_string to wrap {verA}
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.