帮我改下程序 如何打开可变文件
String x;
x=Now().FormatString( "hh ");
char const *Path = "d:\\gsglyb09.txt ";
TStringList * list1=new TStringList();
list1-> LoadFromFile(Path);
我想把文件gsglyb09.txt中的09换成变量x(每天的日期),这样每天都可以打开对应的文件,该如何在我的程序上改进? 说白了就是9号打开gsglyb09.txt,10号打开gsglyb010.txt~
[解决办法]
char const *Path = "d:\\gsglyb "+x+ ".txt ";
[解决办法]
String strFileName = String().sprintf( "d:\\gsglyb%s.txt ", Now().FormatString( "hh "));
TStringList *pList = new TStringList();
if(FileExists(strFileName))
pList-> LoadFromFile(strFileName);
...
delete pList;