LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

sscanf

sscanf

int sscanf (const char sourceString[], const char formatString[], ...);

Purpose

Converts input from the specified source string into a series of values according to the specifiers in formatString. If copying takes place between objects that overlap, the behavior is undefined.

Parameters

Input
Name Type Description
sourceString const char [] Contains a pointer to the string that the input to be converted is obtained from.
formatString const char [] Contains the format string that specifies the admissible input sequences and how they are converted for assignment. Use standard ANSI C format specifiers. If insufficient arguments exist for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated but are otherwise ignored.
Note Note  For more information about the standard ANSI C format specifiers, refer to an external ANSI C reference.
Output
Name Type Description
target_s ... Contains a pointer to the object that receives the converted input from the source string. If there are multiple arguments, you must separate the arguments by commas.

Return Value

Name Type Description
ItemsFormatted int Contains the number of parameters successfully matched and formatted or EOF (-1) in case of an invalid input. This value might be less than the number of parameters you pass in for matching in the following cases:

  • The input or the format string contains fewer elements than parameters passed in.
  • The function could not match one of the parameters.
If an error occurs, this function sets errno to a nonzero value.

Additional Information

Library: ANSI C Library

Include file: ansi_c.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Examples

Refer to the following examples that use the sscanf function:

  • dll\basic\cvidll.cws

    Open example
  • userint\colview.cws

    Open example
Was this information helpful?

Previous

fscanf

Next

vscanf

Previous

fscanf

Next

vscanf