如何把字符内容存到一个config.txt文件里!谢谢! 如何把字符内容存到一个config.txt文件里!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用TFileStream读些文件内容,不管是不是.txt都有效 如何写呢?TFileStream是控件还是function呢? var F: TextFile;begin AssignFile(F, 'NEWFILE.$$$'); Rewrite(F); Writeln(F, 'Just created file with this text in it...'); CloseFile(F);end; delphi有一个文件类TIniFile就是专门管理配置文档的。可以随便的操作段和节的内容;procedure SaveConfig(Section, Ident: string; Val: Boolean);begin with TIniFile.Create(GetAppPath + 'Config.ini') do begin try WriteBool(Section, Ident, Val); finally Free; end; end;end; procedure SetConnectionString(ServerName, UserName, Password: string);var SYSINI: TINIFile; tmpstr: String;begin SYSINI := TIniFile.Create(ExtractFilePath(Application.ExeName)+'Config.INI'); try with SYSINI do begin WriteString('Database', 'ServerName', ServerName); WriteString('Database', 'UserName', UserName); tmpstr := Encrypt(Password, ''); WriteString('Database', 'Password', tmpstr); end; finally SYSINI.Free; end;end; 哦,存成文体文件呀,easy!var TxtList:TStringList;begin TxtList:=TStringList.Create; try TxtList.Add('这个就是你要存的串!'); TxtList.SaveToFile('D:\1.txt'); finally TxtList.Free; end;end; 如果是初始化程序,做成INI文件更好 想法和blazingfire(烈焰一样)var Memo1:TMemo;begin Memo1:=TMemo.Create(application.handle); try Memo1,text:='这个就是你要存的串!'; Memo1.lines.savetofile(YourFileName); finally Memo1.free; end;end; 关于ActiveX,急! Socket上接收到的数据用一线程来处理,下面的方法错在哪里?急! delphi[数据库]首选? 如何做文件关联? 画圆:我画了一个圆,可是圆周却是那么的凹凸不平,这是怎么回事? delphi+excel 不知道如何写这个语句,总报错。 有谁会做网易泡泡式样的消息弹出窗口,提供思路也可。 怎样把一幅图片各点的颜色输出到一个文本文件里? 菜鸟问题之:如何使From以全屏方式运行,覆盖开始菜单和任务条? 关于datetimepicker ★★★★★关于ReadEventLog函数的使用---在线等待 如何往SQL Server数据库中存图片!
AssignFile(F, 'NEWFILE.$$$');
Rewrite(F);
Writeln(F, 'Just created file with this text in it...');
CloseFile(F);
end;
begin
with TIniFile.Create(GetAppPath + 'Config.ini') do
begin
try
WriteBool(Section, Ident, Val);
finally
Free;
end;
end;
end;
var
SYSINI: TINIFile;
tmpstr: String;
begin
SYSINI := TIniFile.Create(ExtractFilePath(Application.ExeName)+'Config.INI');
try
with SYSINI do
begin
WriteString('Database', 'ServerName', ServerName);
WriteString('Database', 'UserName', UserName);
tmpstr := Encrypt(Password, '');
WriteString('Database', 'Password', tmpstr);
end;
finally
SYSINI.Free;
end;
end;
var
TxtList:TStringList;
begin
TxtList:=TStringList.Create;
try
TxtList.Add('这个就是你要存的串!');
TxtList.SaveToFile('D:\1.txt');
finally
TxtList.Free;
end;
end;
Memo1:TMemo;begin
Memo1:=TMemo.Create(application.handle);
try
Memo1,text:='这个就是你要存的串!';
Memo1.lines.savetofile(YourFileName);
finally
Memo1.free;
end;
end;