b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

strchr函数_strchr函数 php_strcat函数(2)

电脑杂谈  发布时间:2017-03-17 18:08:27  来源:网络整理

result = stricmp( string1, string2 );

if( result > 0 )

strcpy( tmp, "大于" );

else if( result < 0 )

strcpy( tmp, "小于" );

else

strcpy( tmp, "等于" );

lr_output_message( "stricmp: String 1 %s string 2", tmp );

运行后在executonlog中看到如下语句:

Starting action Action.

Action.c(22): strcmp: String 1 小于 string 2

Action.c(33): stricmp: String 1 等于 string 2

char *strcpy ( char *dest, const char *source );

功能:复制一个字符串到另一个字符串中。

例子:

复制一个字符串到字符数组中,并打印出来。

脚本如下:

char test[1024];

strcpy(test, "what can we see?");

lr_output_message("%s", test);

运行后在executonlog中看到如下语句:

Starting action Action.

Action.c(10): what can we see?

char *strdup ( const char *string );

功能:复制一个字符串。

char *strlwr ( char *string );

功能:转换成小写字母。

例子:

在这个例子中,Vuser的组名被转换为小写字母。但是lr_whoami把组名作为静态buffer返回。这样的buffer不能作。如果有操作需要,就复制这个静态buffer。

脚本如下:

int id;

char *groupname_static, *groupname;

lr_whoami(&id, &groupname_static, NULL);

lr_output_message("groupname=%s", groupname_static);

groupname = (char *)strdup(groupname_static);

groupname = (char *)strlwr(groupname);

lr_output_message("lower case groupname=%s", groupname);

free(groupname);

上述脚本用vugen保存为:CHANGE

在controller中运行(设置为总是发送消息)

运行后在log中看到如下语句:

Starting action Action. [MsgId: MMSG-15919]

Action.c(11): groupname=CHANGE [MsgId: MMSG-17999]

Action.c(16): lower case groupname=change [MsgId: MMSG-17999]

size_t strlen ( const char *string );

功能:返回字符串长度(bytes).

例子:

这个例子很简单,就是得到一个字符串中的字符的个数。然后打印出来。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-38054-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    每日福利
    热点图片
    拼命载入中...