1、字符串拷贝函数 strcpy
①
char * str1 = "hello world";
char str2[50] ;
strcpy(str2,str1);
lr_output_message("%s\n",str2);
return 0;
char str2[50] ;
strcpy(str2,str1);
lr_output_message("%s\n",str2);
return 0;
②
char str2[50];
strcpy(str2,"hello");
strcpy(str2,"hello");
字符串拷贝函数strcpy作用lr_output_message("%s\n",str2);
2、字符串比较大小函数strcmp
2.
3.接拼函数strcat
char * str1 = "hello world";
char * str2 = "jjjjjj";
// char * str3 = "rrrr rr";
char str4[50] ;
// char * str3 = "rrrr rr";
char str4[50] ;
strcat(str4,str1);
strcat(str4,str2);
strcat(str4,str4);
strcat(str4,str2);
strcat(str4,str4);
lr_output_message("%s\n",str4);
return 0;
4、求字符串长度函数strlen
char * str1 = "helloworld";
char str2[10] = "jjjjjj";
int a;
char str2[10] = "jjjjjj";
int a;
a = strlen(str1);
lr_output_message("%d\n",a);
lr_output_message("%d\n",sizeof(str2));
lr_output_message("%d\n",sizeof(str2));
---------------------------------------------------------------------
5、动态链接库、
1、 vc里的脚本
#include <stdio.h>
#include <math.h>
#define LR DLLTEST_API __declspec(dll export)
extern "C" LRDLLTEST_API int Sum(int a , int b);
#include <math.h>
#define LR DLLTEST_API __declspec(dll export)
extern "C" LRDLLTEST_API int Sum(int a , int b);
LRDLLTEST_API int Sum(int a , int b)
{
return a+b;
}
int main(void)
{
int a;
a=Sum(6,10);
printf("%d",a);
}
{
return a+b;
}
int main(void)
{
int a;
a=Sum(6,10);
printf("%d",a);
}
2、lr里的脚本
int s = 100;
int f;
int f;
lr_load_dll("比较大小.dll");
f=Sum(s,200);
lr_save_int(f,"ShuZi");
lr_output_message("%s",lr_eval_string("{ShuZi}"));
return 0;
f=Sum(s,200);
lr_save_int(f,"ShuZi");
lr_output_message("%s",lr_eval_string("{ShuZi}"));
return 0;
-----------------------------------------------------------------------
6、文件的写入
Action()
{
char filename[50]="c:\\";
int filestream;
// \" \\
// sprintf(filename,"c:\\",lr_eval_string("{P_VUSERID}"));
//lr_output_message( "Group: %s, vuser id: %d, scenario id %d",p_vuser_group, id, scid);
lr_output_message("%s",filename);
filestream=fopen(filename,"w");
{
char filename[50]="c:\\";
int filestream;
// \" \\
// sprintf(filename,"c:\\",lr_eval_string("{P_VUSERID}"));
//lr_output_message( "Group: %s, vuser id: %d, scenario id %d",p_vuser_group, id, scid);
lr_output_message("%s",filename);
filestream=fopen(filename,"w");
if(filestream==NULL){
lr_error_message("Open File ERROR");
return -1;
}
fprintf(filestream,"Today is %s",lr_eval_string("{P_TODAY}"));
// free(p_vuser_group);需要释放么?
fclose(filestream);
return 0;
}
lr_error_message("Open File ERROR");
return -1;
}
fprintf(filestream,"Today is %s",lr_eval_string("{P_TODAY}"));
// free(p_vuser_group);需要释放么?
fclose(filestream);
return 0;
}
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
Action()
{ int a=5;
{ int a=5;
char filename[100]="D:\\";
long file = NULL ;
char dd[100];
long file = NULL ;
char dd[100];
lr_save_int (a,"Q");
sprintf(file,"%s",lr_eval_string ("{Q}"));
file = fopen(filename,"w+");
sprintf(file,"%s",lr_eval_string ("{Q}"));
file = fopen(filename,"w+");
fprintf(file,"%s",lr_eval_string ("{Q}"));
//fwrite(dd,1,strlen(file),file);
fclose(file);
return 0;
//fwrite(dd,1,strlen(file),file);
fclose(file);
return 0;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论