我是这样写文件的FileWrite(hand,caption,Length(caption));
caption是widestring类型我有fileopen(hand,str,length(caption));//这里的caption是已经取出的数据大小但读出来全是乱码,为什么呀?怎么解决呢
caption是widestring类型我有fileopen(hand,str,length(caption));//这里的caption是已经取出的数据大小但读出来全是乱码,为什么呀?怎么解决呢
fileread(hand,caption[1],length(caption));
var
h:cardinal;
begin
h:=fileopen(filename,fmopenreadwrite);
fileseek(h,0,0);
filewrite(h,s[1],length(s));
fileclose(h);
end;
function readfile(filename:string;len:cardinal):string;
var
h:cardinal;
begin
h:=fileopen(filename,fmopenread);
fileseek(h,0,0);
setlength(result,len);//关键是这个,先分配空间,然后才能读。
fileread(h,result[1],len);
fileclose(h);
end;