ChinaUnix.net
相关文章推荐:

sscanf详解

相关讨论

sscanf函数 keywords: %[a-z] sscanf delimit 很久以前,我以为c没有自己的split string函数,后来我发现了sscanf;一直以来,我以为sscanf只能以空格来界定字符串,现在我发现我错了。 sscanf是一个运行时函数,原形很简单: int sscanf( const char *buffer, const char *format [, argument ] ... ); 它强大的功能体现在对format的支持上。 我以前用它来分隔类似这样的字符串2006:03:18: int a, b, c; sscanf("20...

by ubuntuer - Linux文档专区 - 2009-04-08 13:49:44 阅读(826) 回复(0)

1.相关头文件:

  1. #include<stdio.h

by yuweixian4230 - 移动操作系统 - 2011-12-20 09:44:08 阅读(1139) 回复(0)

名称: 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 阅读(707) 回复(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 阅读(1445) 回复(0)

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

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

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

by suntoltti - C/C++ - 2012-03-28 09:56:05 阅读(1547) 回复(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 阅读(1421) 回复(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 阅读(3520) 回复(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 阅读(2026) 回复(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 阅读(3450) 回复(14)