lr_save_string 和 sprintf 的使用 http://www.cnblogs.com/sirrah/articles/2349089.html
来源:互联网 发布:人工智能行业投资机会 编辑:程序博客网 时间:2024/05/17 23:41
一、lr_save_string 使用介绍
1.该函数主要是将程序中的常量或变量保存为lr中的参数。
格式:
//将常量保存为参数lr_save_string("777","page");web_url(http://www.sina.com.cn/{page});lr_eval_string("{page}");//将变量保存为参数,tmp为变量lr_save_string(tmp,"page");web_url(http://www.sina.com.cn/{page});lr_eval_string("{page}");
二、sprintf函数
定义函数
int sprintf( char *str,const char * format,.........);函数说明
sprintf()会根据参数format字符串来转换并格式化数据,然后将结果复制到参数str所指的字符串数组,直到出现字符串结束(’\0’)为止。关于参数format字符串的格式请参考printf()。返回值
成功则返回参数str字符串长度,失败则返回-1,错误原因存于errno中。附加说明
使用此函数得留意堆栈溢出,或改用snprintf()。范例
#include<stdio.h>main()
{
char * a=”This is string A!”;
char buf[80];
sprintf(buf,”>>> %s<<<\n”,a);
printf(“%s”.buf);
}
执行
>>>This is string A!<<<常用该函数代替itoa,将整数格式化为字符串形式。
如:
int page=0;char page_ch[56];page=page + 10;sprintf(page_ch,"%d",page);
- lr_save_string 和 sprintf 的使用 http://www.cnblogs.com/sirrah/articles/2349089.html
- fcntl使用 http://www.cnblogs.com/andtt/articles/2178875.html
- fcntl使用 http://www.cnblogs.com/andtt/articles/2178875.html
- STL(from:http://www.cnblogs.com/henryzc/articles/298882.html)
- 转自http://www.cnblogs.com/flashelf/articles/522348.html
- http://www.cnblogs.com/caihongjin/articles/1296004.html
- http://www.cnblogs.com/yayagepei/articles/1285091.html
- http://www.cnblogs.com/hanfei8987/articles/1320380.html
- http://www.cnblogs.com/mcodec/articles/2122675.html
- http://www.cnblogs.com/bronte/articles/2269786.html
- http://www.cnblogs.com/BlueTzar/articles/1223313.html
- http://www.cnblogs.com/pengyingh/articles/2356827.html
- http://www.cnblogs.com/dudu/articles/4449.html
- http://www.cnblogs.com/onlys/articles/jQuery.html
- http://www.cnblogs.com/devilmsg/articles/1266336.html
- http://www.cnblogs.com/flashsky/articles/642720.html
- http://www.cnblogs.com/king-77024128/articles/2666230.html
- http://www.cnblogs.com/kristain/articles/2033566.html
- 如何运行时(动态)加载js脚本|JavaScript
- HDU 2524 矩形A + B
- 模拟录制模式和低级录制模式的区别与规则
- MIT OS lab3--小结续 系统调用与用户接口 (cprintf..)
- QTP 如何增強Debug View 功能
- lr_save_string 和 sprintf 的使用 http://www.cnblogs.com/sirrah/articles/2349089.html
- 简明 Vim 练级攻略
- 《请给我结果》
- Nand: OOB BBT ECC PEB LEB
- 刘翔商业价值是否会一落千丈?
- 《C程序设计伴侣》诞生记
- 获取Android手机所以应用程序并开启
- Google IO中的中的 Log类
- 欧元区利好消息推动,非美震荡上扬