R
ranger
Unregistered / Unconfirmed
GUEST, unregistred user!
各位,有谁知道fileread系列函数的用法吗?
他们有没有什么需要特殊注意的地方?
我想知道一个具体例子程序级我不能成功的原因[?]
不要delphi帮助自带的
请教用fileread的详细用法
如下程序有问题:请问用fileopen,filecreate,filewrite,fileread,fileseek要注意哪些方面?
procedure TForm1.Button1Click(Sender: TObject);
var
str1,str2,str3:string;
i,filehandle,lengthstr:integer;
p1,p2,p3ointer;
iFileHandle: Integer;
iFileLength: Integer;
iBytesRead: Integer;
Buffer: PChar;
begin
FileHandle := FileCreate('d:/filetext');
str1:='hello,';
str2:='every';
// str3 := 'one!';
p1:=pchar(str1);
p2:=pchar(str2);
// p3:=pchar(str3);
FileWrite(FileHandle,p1^,6);
fileclose(filehandle);
filehandle := FileOpen('d:/filetext', fmOpenReadwrite);
FileSeek(FileHandle,0,2);
FileWrite(FileHandle,p2^,5);
fileclose(filehandle);
filehandle := FileOpen('d:/filetext', fmOpenReadwrite);
iFileLength := FileSeek(FileHandle,0,2);
Buffer := PChar(AllocMem(iFileLength + 1));
FileSeek(FileHandle,0,0);
iBytesRead := FileRead(FileHandle, Buffer, iFileLength);
// for i := 0 to iBytesRead-1 do
// begin
// Str3 := str3+ Buffer;
// Str3 := IntToStr(Integer(Buffer));
// end;
FreeMem(Buffer);
showmessage(str3);
fileclose(filehandle);
我读文件读不出来
难道一定要用readstream?
readstream怎么用?
他们有没有什么需要特殊注意的地方?
我想知道一个具体例子程序级我不能成功的原因[?]
不要delphi帮助自带的
请教用fileread的详细用法
如下程序有问题:请问用fileopen,filecreate,filewrite,fileread,fileseek要注意哪些方面?
procedure TForm1.Button1Click(Sender: TObject);
var
str1,str2,str3:string;
i,filehandle,lengthstr:integer;
p1,p2,p3ointer;
iFileHandle: Integer;
iFileLength: Integer;
iBytesRead: Integer;
Buffer: PChar;
begin
FileHandle := FileCreate('d:/filetext');
str1:='hello,';
str2:='every';
// str3 := 'one!';
p1:=pchar(str1);
p2:=pchar(str2);
// p3:=pchar(str3);
FileWrite(FileHandle,p1^,6);
fileclose(filehandle);
filehandle := FileOpen('d:/filetext', fmOpenReadwrite);
FileSeek(FileHandle,0,2);
FileWrite(FileHandle,p2^,5);
fileclose(filehandle);
filehandle := FileOpen('d:/filetext', fmOpenReadwrite);
iFileLength := FileSeek(FileHandle,0,2);
Buffer := PChar(AllocMem(iFileLength + 1));
FileSeek(FileHandle,0,0);
iBytesRead := FileRead(FileHandle, Buffer, iFileLength);
// for i := 0 to iBytesRead-1 do
// begin
// Str3 := str3+ Buffer;
// Str3 := IntToStr(Integer(Buffer));
// end;
FreeMem(Buffer);
showmessage(str3);
fileclose(filehandle);
我读文件读不出来
难道一定要用readstream?
readstream怎么用?