ChinaUnix.net
相关文章推荐:

linux sscanf

名称: sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: Int sscanf( string str, string fmt, mixed var1, mixed var2 ... ); int scanf( const char *format [,argument]... ); 说明: sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入源。 其中的format可以是一个或多个 {% [width] [{h | l | I64 | L}]type | ' ' | '\t' | '\n' | 非%符号} 注: 1、 * 亦可...

by songlin226 - Linux文档专区 - 2008-02-22 17:06:07 阅读(780) 回复(0)

相关讨论

sscanf sscanf,表示从字符串中格式化输入 上面表示从str中,输入数字给x,就是32700 久以前,我以为c没有自己的split string函数,后来我发现了sscanf;一直以来,我以为sscanf只能以空格来界定字符串,现在我发现我错了。 sscanf是一个运行时函数,原形很简单: int sscanf( const char *buffer, const char *format [, argument ] ... ); 它强大的功能体现在对format的支持上。 我以前用...

by SimonChuiShui - AIX文档中心 - 2008-02-19 17:56:52 阅读(1570) 回复(0)

strcpy(buf,"[23423][456][354]"); sscanf(buf,"[%s/][%s/][%s]",buf4,buf2,buf3); 这样写为什么不能把[]种数据提取出来,把[]都换成空格就行为什么啊?

by frankytf - C/C++ - 2007-02-09 16:32:27 阅读(1354) 回复(6)

[160317165559.003.121]2248:开始交易[13748398,sk01] 有上述格式日志数据,如何写 ssanf() 语句,完成数据解析? strcpy(buff, "[160317165559.003.121]2248:开始交易[13748398,SK01]"); sscanf(buff, "%.....", s1, s2, s3, s4); 其中 s1 = "160317165559.003.121" s2 = "开始交易" s3="13748398" s4="SK01"

by ljmmail - C/C++ - 2016-04-02 16:47:07 阅读(1967) 回复(6)

i:16276; i:8472; 请教如何取得上面格式中的数字 谢谢

by suntoltti - C/C++ - 2012-03-28 09:56:05 阅读(1769) 回复(5)

#include int main(void) { char store[4]; int now_num,all_num; sscanf(" \"ME\",2,99,\"ME\",2,99,\"ME\",2,99","%*[^\"]\"%4[^\"]\",%3d,%3d",store,&now_num,&all_num); //sscanf("\"ME\",2,99,\"ME\",2,99,\"ME\",2,99","%*[^\"]\"%4[^\"]\",%3d,%3d",store,&now_num,&all_num); printf("There are %d sms in %s\n",now_num,store); return 0; } 程序执行结果如下: There are 2 sms in ME 如果去掉字...

by iacxin099 - C/C++ - 2011-08-16 13:30:49 阅读(1547) 回复(1)

环境AIX 编译器CC int main() { char s_pin_data[]="123456"; char a[3]; sscanf( s_pin_data, "%2x%2x%2x", &a[0], &a[1], &a[2] ); printf( "\n a0=[%2x],a1=[%2x],a2=[%2x] \n", a[0], a[1], a[2] ); return 1; } 运行结果: a0=[ 0],a1=[ 0],a2=[ 0] 环境xp 编译器vc6.0 a0=[12],a1=[34],a2=[56]

by xiaobenniao514 - C/C++ - 2010-12-10 15:33:02 阅读(3757) 回复(9)

做一个日期转换的,可能有英文可能有中文可能有数字。能知道他的模板,根据模板,能知道他的format。我用sscanf把年月日时间等取出来。可是每次得到的都是一样的内容。 time = "2005-07-05 06:07:15"; sscanf(time, "%s-%s-%s %s:%s:%s", str1, str2, str3, str4, str5, str6); 得到的str1-6怎么全都是2005-07-06?

by lssliu - C/C++ - 2010-08-02 16:46:57 阅读(2209) 回复(3)

I have a string like "access-list 8 per 3.3.3.3 /24", I want to get 24 with sscanf, can you tell me how to do it? the following code can not catch it. sscanf(szCommand, "/%d", &ulSrcMask) thanks.

sscanf

by mypromise - C/C++ - 2010-06-24 16:38:40 阅读(3591) 回复(14)

目的:将name1和name2的值读到b和c中, 问题:当name1的值不为空时正常(name1=“test1”,name2=“test2”) 当name1的值为空时name2就读不到了(name1=“”,name2=“test2”) int main() { char a[]="name1=\"\",name2=\"test2\"",b[24]="",c[24]=""; // char a[]="name1=\"test1\",name2=\"test2\"",b[24]="",c[24]=""; printf("%s\n",a); sscanf(a,"name1=\"%[^\"]\",name2=\"%[^\"]...

by 20040925 - C/C++ - 2010-05-12 12:20:13 阅读(1139) 回复(1)

#include #include #include #include #define KEYLEN 4 int main(int arg,char ** argv) { if (arg != 2 ) { printf("%s your_bin_array_strings\n",*++argv); _exit(1); } int i=0,j=0; unsigned char buf[KEYLEN]; for(i=0;i

by 027xiatian - C/C++ - 2009-11-30 16:58:52 阅读(1158) 回复(1)