各位大哥:
怎样去修改一个已有的文件的文件名
还有怎样去建一个新文件
就这么多了
谢谢!!
怎样去修改一个已有的文件的文件名
还有怎样去建一个新文件
就这么多了
谢谢!!
解决方案 »
- 如何控制F1BOOK每格的字体颜色?
- 怎么用DELPHI的一个ADOCConnections 连接不同的数据库
- 程序有1个主窗体(包含一个treeview控件),3个子窗体.实现功能:点击treeview项目后,3个子窗体能知道被点击项目的名字.
- sql语句
- 很简单,编译后生成的*.dcu,*.dcr文件用什么工具可以打开?
- 如何在DBGRID显示字段的时候显示人民币符号'¥'?
- 出现记录条数为-1的情况
- 如何获取当前操作系统的版本
- 请问有没有带checkbox的treeview的控件,也就是每个显示名称前有个checkbox的选择?
- 怎样让listbox用程序选择其中的一个item并得到焦点
- 送分(在线等待)
- 请教高手一个问题!!!怎样读取office文件?
Createfile(fileName)
procedure TForm1.Button1Click(Sender: TObject);
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;
FileCreate(const FileName: string): Integer;
LPSHFILEOPSTRUCT lpFileOp
);