我的问题大致是这样的:我要把olecontainer中的内容以流的形式存到一个文件中,而且我要多次存入到该文件中,然后我再取出来,大致思路是这样的:在文件头处记录下每次存入时的一个id号,以及起始位置,数据长度,之后再取出来,但是操作总有问题,存入的时候倒是可以,但是取出的时候总是提示说"stream read error".哪位做过这方面的东西,能否给提供一下源码供参考一下。分数不是问题。解决问题一切都好说!
解决方案 »
- 提问程序死循环的检测...
- 利用TIdHttp控件下载文件和vista的兼容问题,高手进来看看
- 在chart控件中,在程序运行时怎么能实现对单个Series1用鼠标进行左右平移的拖动!在线等待!
- 系统服务和应用程序的区别
- 建议CSDN保留原来的登陆模式,可以在保留登陆信息,以后都不用登陆.
- 在线等待-100分(问几个很菜的问题,每个20分!!)
- 我想去北京工作大家看看我值多少钱
- 不知道有没有人知道这是哪个国家的语言文字(编程技术文章)???要是没人知道,就当是散分吧!
- 如何在QuickRep1中一页只打印一条记录呀?急
- [■■■Delphi猛料■■■]V1.3发布~~~~~~~更新到2001.12.12
- 请教:学习CSDN的“绝对经典的完整的RPG”源码
- 菜鸟问题:请大侠给我解释一下啥是DCOM?为啥要用DCOM?
var
f:textfile;
info:FILE_INFO;
i,j:integer;
buf:array[0..4096] of byte;
s:integer;
count,b:integer;
dir,strtmp:string;
FilebottomInfo:array[0..100] of byte;
FileLen:Longint;
begin
//dir:=GetTempDirectory;
strtmp:=' ';
for j:=0 to 100 do
FilebottomInfo[j]:=0;
dir:=path;
try
fstream1:=tfilestream.Create(paramstr(0),fmShareDenyWrite);
filelen:=GetFileSize(application.ExeName);
fstream1.Seek(filelen-100,soFromBeginning);
fstream1.Read(FilebottomInfo,sizeof(filebottominfo));
try
j:=0;
while (j<10)do
begin
if (FilebottomInfo[j]>47) and (FilebottomInfo[j]<121) then
strtmp[j+1]:=chr(FilebottomInfo[j])
else
strtmp[j+1]:=chr(32);
j:=j+1;
end;
filelen:=strtoint(trim(strtmp));
except
exit;
end;
fstream1.Seek(filelen,soFromBeginning);
while fstream1.Position<>fstream1.Size-100 do
begin
fstream1.Read(info,sizeof(info));
count:=0;
assignfile(f,dir+info.filename);
rewrite(f);
closefile(f);
fstream2:=tfilestream.Create(dir+info.filename,fmopenwrite);
fstream2.Size:=0;
i:=info.len div sizeof(buf);
for b:=1 to i do
begin
s:=fstream1.Read(buf,sizeof(buf));
fstream2.Write(buf,s);
inc(count,s);
end;
s:=fstream1.Read(buf,info.len-count);
fstream2.Write(buf,s);
fstream2.Free;
end;
finally
fstream1.Free;
end;
end;