Example: lrs_get_user_buffer_size

In the following example, lrs_get_user_buffer_size retrieves the size of the user buffer, "buf10", received on "socket1", containing "\x17\x01X-AUTHENTICATION-1".

char *UserBuf, *StrToLog;
int LenOfUserBuf;
lrs_get_static_buffer("socket1", "buf10", 0, -1, NULL);
UserBuf = lrs_get_user_buffer("socket1");
LenOfUserBuf = lrs_get_user_buffer_size("socket1");
StrToLog = (char*)malloc(LenOfUserBuf + 1);
/* Copy user buffer and skip two unprintable characters at the beginning */
strncpy(StrToLog, UserBuf+2, LenOfUserBuf-2); 
lr_output_message("UserBuf = \"%s\"", StrToLog);
lr_output_message("The buffer size = \"%d\"", LenOfUserBuf);
The output generated by the above code, as seen in the VuGen Execution log is:
Message from run.c(52): UserBuf = "X-AUTHENTICATION-1"
Message from run.c(52): The buffer size = 20