$PBExportHeader$f_filetoblob.srf global type f_filetoblob from function_object end type forward prototypes global function integer f_filetoblob (string arg_filepathname, ref blob arg_blobdata, ref string arg_msg) end prototypes global function integer f_filetoblob (string arg_filepathname, ref blob arg_blobdata, ref string arg_msg);//读入数据 long flen,loops,ls_i,bytes_read,new_pos,rslt=1,li_FileNum blob b_dtdata_p,tot_b flen = FileLength(arg_filepathname) li_FileNum = FileOpen(arg_filepathname, StreamMode!, Read!, LockWrite!) if li_FileNum=-1 then rslt=0 arg_msg='打开文件'+arg_filepathname+'操作失败!' fileclose(li_FileNum) goto ext end if IF flen > 32765 THEN IF Mod(flen, 32765) = 0 THEN loops = flen/32765 ELSE loops = (flen/32765) + 1 END IF ELSE loops = 1 END IF new_pos = 1 FOR ls_i = 1 to loops bytes_read = FileRead(li_FileNum, b_dtdata_p) if bytes_read=0 then rslt=0 arg_msg='读取文件'+arg_filepathname+'操作失败!' fileclose(li_FileNum) goto ext end if tot_b = tot_b + b_dtdata_p NEXT fileclose(li_FileNum) arg_blobdata=tot_b ext: return rslt end function