$PBExportHeader$f_filetostring.srf global type f_filetostring from function_object end type forward prototypes global function integer f_filetostring (string arg_filepathname, ref string arg_stringdata, ref string arg_msg) end prototypes global function integer f_filetostring (string arg_filepathname, ref string arg_stringdata, ref string arg_msg);//读入数据 long flen,loops,ls_i,bytes_read,new_pos,rslt=1,li_FileNum string ls_dtdata_p,tot_s flen = FileLength(arg_filepathname) li_FileNum = FileOpen(arg_filepathname, TextMode!, Read!, Shared!,Replace!,EncodingUTF16LE!) 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 = FileReadEx(li_FileNum, ls_dtdata_p) if bytes_read=0 then rslt=0 arg_msg='读取文件'+arg_filepathname+'操作失败!' fileclose(li_FileNum) goto ext end if tot_s = tot_s + ls_dtdata_p NEXT arg_stringdata = tot_s fileclose(li_FileNum) ext: return rslt end function