BCB6開啟連續號碼檔名
使用BCB內建的AnsiString可以用printf函數,以類似C/C++的方法處理
AnsiString fpath;
AnsiString fname = "abc";
for (int i=0 ; i<10 div="" i="">10>
{
fpath.printf("C:\\%s%d.txt", fname, i);
// or ...
// fpath = "C:\\" + fname + IntToStr(i) + ".txt";
FILE* out = fopen(fpath.c_str(), "wb");
if(out == NULL) {
cout << "cannot open file = " << fpath.c_str() << endl;
continue; // skip this file, process the next
}
// ...
fclose(out);
}
|
留言