![Advantech UbiQ User Manual Download Page 87](http://html1.mh-extra.com/html/advantech/ubiq/ubiq_user-manual_2856809087.webp)
81
UbiQ Scenario Manager User Manual
Chapter 5
Functions
Reference
5.2.29
sprintf
Syntax
void sprintf(char* pBuf, char* pFormat,... or
void sprintf(char* pBuf, string sFormat,...)
Parameters
pBuf: Specifies the destination array.
pFormat : Specifies the Null-end character array format
sFormat: Specifies the string format
...: Specifies more variant variables to be added into the format string
Description
This function returns the number of bytes stored in buffer, not counting the ter-
minating null character.
Comments
The sprintf function formats and stores a series of characters and values in
buffer. Each argument (if any) is converted and output according to the corre-
sponding format specification in format. The format consists of ordinary charac-
ters and has the same form and function as the format argument for printf. A
null character is appended after the last character written. If copying occurs
between strings that overlap, the behavior is undefined.
Example
// The example will show the pChar and f1 in the debug window
char pChar[20]; // declare pChar as char[20]
double f1; // declare f1 as double
int nI;
string aStr;
char pData[15];
char pBuf[50];
f1=2.789;
nI=120;
pData=”Test Printf”;
aStr=”Test printf 2”;
setdebug(TRUE);
sprintf(pBuf,”The f1=%f, nI=%d, pBuf=%s, aStr=%s”,f1,nI,pBuf,aStr);
See Also
printf, debug , setdebug
Summary of Contents for UbiQ
Page 1: ...User Manual UbiQ Scenario Manager User Manual V1 03...
Page 4: ...UbiQ Scenario Manager User Manual iv...
Page 7: ...Chapter 1 1 Introduction...
Page 13: ...Chapter 2 2 Getting Started...
Page 37: ...Chapter 3 3 Tutorials...
Page 47: ...Chapter 4 4 Basic of Smart C Script Language...
Page 62: ...UbiQ Scenario Manager User Manual 56...