Posted on 2006-05-12 15:02
semovy 閱讀(1369)
評(píng)論(0) 編輯 收藏 所屬分類(lèi):
C++ Builder相關(guān)
void?__fastcall?TForm1::BitBtn2Click(TObject?*Sender)
{
int?fileHandle?=?0;
if(SaveDialog1->Execute())
{
if(FileExists(SaveDialog1->FileName))
{
?if(Application->MessageBoxA(\\\"該文件已經(jīng)存在,是否替換?\\\",\\\"信息提示框\\\",MB_YESNO)?==?6)
?{
fileHandle?=?FileCreate(SaveDialog1->FileName);
String?str?=?\\\"第一列\(zhòng)\\\t\\\\t第二列\(zhòng)\\\t\\\\t第三列\(zhòng)\\\t\\\\t第四列\(zhòng)\\\t\\\\t第五列\(zhòng)\\\r\\\\n\\\";
FileWrite(fileHandle,str.c_str(),?str.Length());
for(int?i=0;i<10;i++)
FileWrite(fileHandle,str.c_str(),?str.Length());
FileClose(fileHandle);
ShowMessage(\\\"OK\\\");
?}
else
{
?return;
}
?}
?else
?{
?fileHandle?=?FileCreate(SaveDialog1->FileName);
String?str?=?\\\"第一列\(zhòng)\\\t\\\\t第二列\(zhòng)\\\t\\\\t第三列\(zhòng)\\\t\\\\t第四列\(zhòng)\\\t\\\\t第五列\(zhòng)\\\r\\\\n\\\";
FileWrite(fileHandle,str.c_str(),?str.Length());
for(int?i=0;i<10;i++)
FileWrite(fileHandle,str.c_str(),?str.Length());
FileClose(fileHandle);
ShowMessage(\\\"OK\\\");
?}
}
}?