1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- $PBExportHeader$f_saveblobtofile.srf
- global type f_saveblobtofile from function_object
- end type
- forward prototypes
- global function integer f_saveblobtofile (blob arg_bdata, string arg_filename, ref string arg_msg)
- end prototypes
- global function integer f_saveblobtofile (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 = lena(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
|