We've recently installed VISA 2.6 on our systems and have found that our routines making use of viQueryf are no longer working. We've narrowed it down to two main problems:
1. When using "%#t", the size of the array is returned instead of the number of characters read, unless the size of the array is less than the number of characters read.
For example:
ViInt32 strSize = 256;
ViChar stringResult[256] = "\0";
stringResult[0] = 0;
ErrStatus = viQueryf(SessionID, "%s\n", "%#t",
"SYST:ERR?", &strSize,
stringResult);
This returns 256 as the strSize, even through only 14 characters are returned in the string. If I change strSize to 0, then after r
unning the function, it returns 14.
2. The function is not writing a null-terminating character to the return string. For example:
ViInt32 errorCode = 0;
ViChar errorMessage[256] = "abcdefghijklmnopqrstuvwxyz0124556789";
ErrStatus = viQueryf(SessionID, "SYST:ERR?\n", "%ld,%t", &errorCode, errorMessage);
After executing this, errorMessage contains "No error"\nlmnopqrstuvwxyz0124556789.
Flushing the buffer does not change the results, nor does setting the first character to null or calling sprintf(errorMessage, "\0"). The only way we've been able to work around this is to zero-fill the string previous to calling the function.
Are there any workarounds or fixes for these problems?
Scott