12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- $PBExportHeader$f_saveblobtofile_rpt.srf
- global type f_saveblobtofile_rpt from function_object
- end type
- forward prototypes
- global function integer f_saveblobtofile_rpt (blob arg_bdata, string arg_filename, ref string arg_msg)
- end prototypes
- global function integer f_saveblobtofile_rpt (blob arg_bdata, string arg_filename, ref string arg_msg);//f_saveblobtofile
- long rslt=1
- long fend,li_FileNum,fend_t,ls_i,ls_jh
- blob b_dtdata_p
- //if len(b_dtdata)32765
- fend=len(arg_bdata)
- if fend<=32765 then
- fend_t=1
- else
- fend_t=fend/32765
- if mod(fend,32765)<>0 then
- fend_t=fend_t+1
- end if
- end if
- li_FileNum = FileOpen( arg_filename,StreamMode!, Write!, LockWrite!)
- if li_FileNum<=0 then
- arg_msg="打开文件"+arg_filename+"失败"
- rslt=0
- fileclose(li_FileNum)
- goto ext
- end if
- for ls_i = 1 to fend_t
- b_dtdata_p=blobmid(arg_bdata,1+(ls_i - 1 )*32765,32765)
- ls_jh=FileWrite(li_FileNum, b_dtdata_p)
- if ls_jh<=0 then
- arg_msg="写文件"+arg_filename+"失败"
- rslt=0
- fileclose(li_FileNum)
- goto ext
- end if
- next
- fileclose(li_FileNum)
- ext:
- return rslt
- end function
|