您的位置:首页 > 其它

LR下载文件脚本

2012-03-27 11:31 183 查看
思路如下:

1.设置接收大小,单位是character

2.保存要接收的内容到参数,后面文件存储的内容来源于这个参数信息

3.获取要下载文件的大小

4.使用fopen(*filename,mode) open a file for buffer I/O,注意,返回值是long类型,请参考帮助文档

5.写文件

6.关闭文件流。

源代码如下:

Action()

{

int iflen;

long lfbody;

web_set_max_html_param_len("10000");

web_reg_save_param("Downexe","LB=","RB=",LAST);

web_url("downloadprocess",

"URL=http://www.cn-java.com/download/07.pdf",

"Resource=1",

"RecContentType=application/pdfl",

"Referer=",

LAST);

iflen=web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

lr_output_message("%d",iflen);

if(iflen>0){

if((lfbody=fopen("c:\\fetion.pdf","wb"))==NULL)

{

lr_output_message("Error when write file");

return -1;

}

fwrite(lr_eval_string("{Downexe}"),iflen,1,lfbody);

lr_output_message("write successful");

fclose(lfbody);

}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: