标签:字符串处理 amp dep item sid NPU using items col
// crt_sscanf.c // compile with: /W3 // This program uses sscanf to read data items // from a string named tokenstring, then displays them. #include <stdio.h> int main( void ) { char tokenstring[] = "15 12 14..."; char s[81]; char c; int i; float fp; // Input various data from tokenstring: // max 80 character string: sscanf( tokenstring, "%80s", s ); // C4996 sscanf( tokenstring, "%c", &c ); // C4996 sscanf( tokenstring, "%d", &i ); // C4996 sscanf( tokenstring, "%f", &fp ); // C4996 // Note: sscanf is deprecated; consider using sscanf_s instead // Output the data read printf( "String = %s\n", s ); printf( "Character = %c\n", c ); printf( "Integer: = %d\n", i ); printf( "Real: = %f\n", fp ); }
String = 15 Character = 1 Integer: = 15 Real: = 15.000000
int xPos = 1; int yPos = 2; char str[50]; sprintf(str, "x:%d,y:%d;", xPos, yPos);
标签:字符串处理 amp dep item sid NPU using items col
原文地址:https://www.cnblogs.com/ScarecrowMark/p/11578526.html