VMS Help
CC, Run-time functions, sscanf, Conversion Specifier

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  d           Expects a decimal integer in the input whose format is
              the same as expected for the subject sequence of the
              strtol function with the value 10 for the base
              argument.  The corresponding argument must be a pointer
              to int.

  i           Expects an integer whose type is determined by the
              leading input characters.  For example, a leading 0 is
              equated to octal, a leading 0X is equated to
              hexadecimal, and all other forms are equated to
              decimal.  The corresponding argument must be a pointer
              to int.

  o           Expects an octal integer in the input (with or without
              a leading 0).  The corresponding argument must be a
              pointer to int.

  u           Expects a decimal integer in the input whose format is
              the same as expected for the subject sequence of the
              strtoul function with the value 10 for the base
              argument.

  x           Expects a hexadecimal integer in the input (with or
              without a leading 0x).  The corresponding argument must
              be a pointer to unsigned int.

  c           Expects a single byte in the input.  The corresponding
              argument must be a pointer to char.  If a field width
              precedes the c conversion specifier, the number of
              characters specified by the field width is read.  In
              this case, the corresponding argument must be a pointer
              to an array of char.

  C           Expects a multibyte character in the input which is
              converted into a wide character code.  The
              corresponding argument must be a pointer to type
              wchar_t.  If a field width precedes the C conversion
              specifier, the number of characters specified by the
              field width is read; in this case, the corresponding
              argument must be a pointer to array of wchar_t.

  s           Expects a sequences of bytes in the input.  The
              corresponding argument must be a pointer to an array of
              characters that is large enough to contain the sequence
              plus a terminating null character, which is added
              automatically.  The input field is terminated by a
              space, tab, or new-line character.

  S           Expects a sequence of multibyte characters in the
              input, which are converted to wide-character codes.
              The corresponding argument must be a pointer to an
              array of wide characters (type wchar_t) that is large
              enough to contain the sequence plus a terminating null
              wide-character code which is added automatically.  The
              input field is terminated by a space, tab, or new-line
              character.

  e,f,g       Expects a floating-point number in the input.  The
              corresponding argument must be a pointer to float.  The
              input format for floating-point numbers is:

              [+|-]nnn[radix][ddd][{E|e}[+|-]nn]

              The n's and d's are decimal digits (as many as
              indicated by the field width minus the signs and the
              letter E).  The radix character is defined in the
              current locale.

  [...]       Expects a nonempty sequence of characters that is not
              delimited by a white-space character.  The brackets
              enclose a set of characters (the scanset) expected in
              the input sequence.  Any character in the input
              sequence that does not match a character in the scanset
              terminates the character sequence.  The corresponding
              argument must be a pointer to an array of characters.

              All characters between the brackets comprise the
              scanset, unless the first character after the left
              bracket is a circumflex (^).  In this case, the scanset
              contains all characters other than those that appear
              between the circumflex and the right bracket; that is,
              any character that does appear between the circumflex
              and the right bracket will terminate the input
              character sequence.

              If the conversion specifier begins with [] or [^], the
              right-bracket character is in the scanset and the next
              right-bracket character is the matching right bracket
              that ends the specification; otherwise, the first right
              bracket character ends the specification.

  p           An argument that is a pointer to void.  The input value
              is interpreted as a hexadecimal value.

  n           No input is consumed.  The corresponding argument is a
              pointer to an integer.  The integer is assigned the
              number of characters read from the input stream so far
              by this call to the formatted input function.
              Execution of a %n directive does not increment the
              assignment count returned when the formatted input
              function completes execution.

  %           Matches a single percent symbol.  No conversion or
              assignment takes place.  The complete conversion
              specification would be %%.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.