LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

sprintf

sprintf

int sprintf (char targetString[], const char formatString[], ...);

Purpose

Writes output to the specified string according to format specifiers in formatString. A null character is written at the end of the characters written.

Parameters

Input
Name Type Description
formatString const char [] Contains the format string that specifies how subsequent arguments are converted for output. 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.
source_s ... This specifies one or more arguments that are to be converted and written to the target string. If there are multiple arguments, they must be separated by commas.
Output
Name Type Description
targetString char [] Contains the string to which the formatted data is written. A null character is written at the end of the characters written to this parameter.

Return Value

Name Type Description
CharactersWritten int Contains the number of characters transmitted or a negative value if an output error occurred.
Note Note  The terminating null character is not included as part of the sum of characters transmitted.

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 sprintf function:

  • apps\uirview\uirview.cws

    Open example
  • dll\basic\cvidll.cws

    Open example
  • userint\events.cws

    Open example
  • userint\graphlegend.cws

    Open example
  • userint\gridview.cws

    Open example
  • userint\listdelx.cws

    Open example
  • utility\clock.cws

    Open example
Was this information helpful?

Previous

fprintf

Previous

fprintf