Valid conversion type specifiers – Measurement Computing LogBook Series User Manual
Page 97

LogBook User’s Manual
958396
GPS and Serial Device Data Collection 6-9
The following table of examples shows how each format string operates on a series of serial input strings:
Format Strings Associated with three Serial Channels
Serial input string from device
LOAD:%f
%*14c%i
%*i,%*i,%*i,%f
LOAD:+12.345
+12.345
Failed. After rejecting 14
characters, none were left.
Failed attempting to match 1
st
integer in format string.
12,45,23,453.234
Failed
attempting to
match
“LOAD:”.
34. After skipping 14
characters, the last 2 numbers
were converted.
+453.234. Three integers
separated by commas
rejected.
11.1 22.2 33.3 44.4 55.5
Failed
attempting to
match
“LOAD:”.
44. Converted first integer
after ignoring 1
st
14
characters.
Failed after the 1
st
decimal
point was encountered. The
decimal point is neither an
integer nor a comma.
Valid Conversion Type Specifiers
c
Any sequence of characters in the input stream of the length specified by the field width, or a single
character if no field width is specified, is matched.
d
A decimal integer, consisting of an optional sign, followed by one or more decimal digits, is matched.
Leading white-space characters are skipped.
e, f, g A floating-point number, consisting of an optional sign ("+" or "-"), followed by one or more decimal
digits. The e specifier accepts scientific notation, i.e., 1.234E+12, while the f specifier accepts non-
scientific notation values, i.e., 1.1234. The g specifier accepts either. Leading white-space characters
are skipped.
i
An optional sign, followed by an octal, decimal, integer, or hexadecimal constant is matched. An
octal constant consists of "0" and zero or more octal digits. A decimal constant consists of a non-zero
decimal digit and zero or more decimal digits. A hexadecimal constant consists of the characters
"0x" or "0X" followed by one or more (upper- or lowercase) hexadecimal digits. Leading white-
space characters are skipped.
o
An octal integer, consisting of an optional sign, followed by one or more (zero or non-zero) octal
digits, is matched. Leading white-space characters are skipped.
s
A sequence of non-white-space characters is matched. Leading white-space characters are skipped.
u
An unsigned decimal integer, consisting of one or more decimal digits, is matched. Leading white-
space characters are skipped.
x
A hexadecimal integer, consisting of an optional sign, followed by an optional prefix "0x" or "0X,"
followed by one or more (upper- or lowercase) hexadecimal digits, is matched. Leading white-space
characters are skipped.
%
A conversion type specifier of "%" is treated as a single ordinary character that matches a single "%"
character in the input data.