【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.2.46 sscanf
Contents
Description
Read data from a string according to a standard C format specification.
Syntax
int sscanf( LPCSTR lpcszBuffer, LPCSTR lpcszFormat, ... )
Parameters
- lpcszBuffer
- [input] String to search through for formated data
- lpcszFormat
- [input] Standard C format specification
- ...
- [input] A comma separated list of receptor variables to hold returned data values. For %s type, the variable should be a character buffer.
Return
Returns the number of data values which are returned in receptor variables.
Examples
EX1
void sscanf_ex1() { char str2[10], str1[]="Hello C 15 17.56"; char cChar; int iInt; float fFloat; int N; N = sscanf( str1, "%s %c %d %f", str2, &cChar, &iInt, &fFloat); out_str(str1); out_str(str2); printf("%c\n",cChar); out_int("",iInt); out_double("",fFloat); }
Remark
Read data from a string according to a standard C format specification and return data
values in a series of user specified receptor variables.
See Also
Header to Include
origin.h