fopen问题 ( 积分: 100 )

  • 主题发起人 主题发起人 pengfeiyan
  • 开始时间 开始时间
P

pengfeiyan

Unregistered / Unconfirmed
GUEST, unregistred user!
c的代码:
UCHAR *imageBuffer=new UCHAR[Size];
FILE *pFile=fopen("c:/a1.jpg",wb");
fwrite(imageBuffer,Size,1,pFile);
我翻译delphi:
var imagebuffer:array [0..size-1] of byte;
f := TFileStream.Create("c:/a1.jpg", fmOpenWrite);
try
f.Seek(0, soFromBeginning);
f.Write(imageBuffer,length(imageBuffer));
finally
f.Free;
end;
 
var
imagebuffer:array [0..size-1] of byte;
f: TFileStream;
begin
f := TFileStream.Create('c:/a1.jpg', fmCreate or fmOpenWrite or fmShareDenyNone);
try
f.Seek(0, soFromBeginning);
f.Write(imageBuffer,sizeof(imageBuffer));
finally
f.Free;
end;
end;
 
问题解决,谢谢kaida
 
后退
顶部