高手帮帮忙,最好给详细点的代码
解决方案 »
- IDTCPCLIENT关掉,但是IDTCPSERVER 的ondisconect事件不能被激发
- 如何从当前Active的web页面中获取其文本框中的信息?
- 来深圳20天,简历发了5份,没人理
- 急啊!请问各位高手,怎样调用Windows自己的包含有YesToAll和NoToALl按钮的对话框?谢谢啊:)
- 高手去哪了???急
- 如何动创建Tabel某个字段的OnChange事件?
- 关于Delphi和SqlServer的问题
- ado访问excel
- 请问:我自制的组件在packages上能找到,但在组件面板上找不着对应页标签,我该怎么办?
- 如何用sql语句来备份和恢复按指定的表的条件
- 找到的句柄怎么不对
- 帮帮忙把,qucickreport打印
var
BackupName: string;
FileHandle: Integer;
StringLen: Integer;
X: Integer;
Y: Integer;
begin
if SaveDialog1.Execute then
begin
if FileExists(SaveDialog1.FileName) then
begin
BackupName := ExtractFileName(SaveDialog1.FileName);
BackupName := ChangeFileExt(BackupName, '.BAK');
if not RenameFile(SaveDialog1.FileName, BackupName) then raise Exception.Create('Unable to create backup file.');
end;
FileHandle := FileCreate(SaveDialog1.FileName);
{ Write out the number of rows and columns in the grid. }
FileWrite(FileHandle,
StringGrid1.ColCount, SizeOf(StringGrid1.ColCount));
FileWrite(FileHandle,
StringGrid1.RowCount, SizeOf(StringGrid1.RowCount));
for X := 0 to StringGrid1.ColCount ?1 do
begin for Y := 0 to StringGrid1.RowCount ?1 do
begin
{ Write out the length of each string, followed by the string itself. }
StringLen := Length(StringGrid1.Cells[X,Y]);
FileWrite(FileHandle, StringLen, SizeOf(StringLen));
FileWrite(FileHandle,
StringGrid1.Cells[X,Y], Length(StringGrid1.Cells[X,Y]);
end;
end;
FileClose(FileHandle);
end;end;
FList: TStringList;
tmpStr: String;
Begin
FList:= TStringList.Create;
FList.LoadFromFile('filename');
showmessage(flist[1])
reset(文件名)//打开文件
read 读
readln 读一行
write 写
writeln 写一行
var
i : Integer;
begin
for i := length(FileName) downto 1 do
begin
if FileName[i] = '\' then
begin
Break
end;
end;
if i <= 1 then
begin
Result := GetNameDir(Application.ExeName);
end
else
begin
Result := copy(FileName,1,i);
end;
end;
procedure TForm1.BitBtn6Click(Sender: TObject);
var
FileName : TextFile;
Str,Tmp : String;
TStrList : TStringList;
i,k : Integer;
begin
TStrList := TStringList.Create;
TStrList.Clear;
if not (FileExists(GetNameDir(Application.ExeName)+'xuanhao.txt')) then
begin
Application.MessageBox('xuanhao.txt文件不存在,请先转出TXT文件','提示',MB_OK+MB_ICONSTOP);
Exit;
end;
AssignFile(FileName,GetNameDir(Application.ExeName) + 'xuanhao.txt');
Reset(FileName);
Readln(FileName,Str);
CloseFile(FileName);