关于fileread的问题。。。
各位大侠帮忙看一下以下的读、写文件是否正确,小的看了半天也看不出错误来
以下是读文件
li_filelen = filelength(filename)
li_file = fileopen(filename,StreamMode!,Read!,LockRead!)
if li_file <> -1 then
if li_filelen > 32765 then
if mod(li_filelen,32765) = 0 then
li_loop = li_filelen / 32765
else
li_loop = (li_filelen / 32765) + 1
end if
else
li_loop = 1
end if
ll_pos = 0
do while li_loop > 0
fileread(li_file,lb_tmp)
ll_pos += 32765
FileSeek(li_file,ll_pos + 1)
lb_file = lb_file + lb_tmp
li_loop --
loop
end if
fileclose(li_file)
以下是写文件
li_filenum = fileopen(filepath,StreamMode!,Write!,LockWrite!,Append!)
if li_filenum <> -1 then
if mod(len(lb_file),32765) <> 0 then
li_loop = len(lb_file) / 32765
li_loop = 1 + li_loop
else
li_loop = len(lb_file) / 32765
end if
do while li_loop > 0
blobmid(lb_file,li_pos + 1,32765)
filewrite(li_filenum,lb_file)
li_pos = li_pos + 32765
li_loop --
loop
fileclose(li_filenum)