I keep getting errors (unknown specifier) on following code, using CVI7.0:
sscanf(temp_str, "%lg%*t", r64Result);
temp_str has numerical values. I don't know what the above format specifier in sscanf means. Can anyone help. This is all over the driver code that I inherited.
I don't have your final answer, but here's a little more breakdown on the format string in your statement. %lg g = floating point in e format (e.g. 5.4321E+03) or f format (e.g. 5432.1). l = long (or double for a floating point number). So %lg = double. %*t * = skip this field. t = ??? unknown specifier (at least to me and CVI). I couldn't find any documentation for a t format specifier. Since the * says to skip the field anyway, it seems safe to me to delete that term and to leave your format string "%lg". Remember that sscanf (like other flavors of scanf) is looking for a pointer to the variable to be filled. Verify that the declaration for r64Result creates a pointer: double *r64Result; If the declaration is double r64Result; any other uses expect r64Resu lt to hold a double, change the sscanf statement to sscanf(temp_str, "%lg", &r64Result); What tools were originally used to create your driver?
Thanks guys. I knew about %lg, but have never seen "%*t". Oh well I changed the code to use only "%lg" and it works.
vishi
Al S wrote: > I don't have your final answer, but here's a little more breakdown on > the format string in your statement. > %lg > g = floating point in e format (e.g. 5.4321E+03) or f format (e.g. > 5432.1). > l = long (or double for a floating point number). > So %lg = double. > %*t > * = skip this field. > t = ??? unknown specifier (at least to me and CVI). > I couldn't find any documentation for a t format specifier. Since the > * says to skip the field anyway, it seems safe to me to delete that > term and to leave your format string "%lg". > Remember that sscanf (like other flavors of scanf) is looking for a > pointer to the v ariable to be filled. Verify that the declaration for > r64Result creates a pointer: > double *r64Result; > If the declaration is > double r64Result; > any other uses expect r64Result to hold a double, change the sscanf > statement to > sscanf(temp_str, "%lg", &r64Result); > What tools were originally used to create your driver?