Posted on 2006-05-12 15:02
semovy 閱讀(1369)
評論(0) 編輯 收藏 所屬分類:
C++ Builder相關
void?__fastcall?TForm1::BitBtn2Click(TObject?*Sender)
{
int?fileHandle?=?0;
if(SaveDialog1->Execute())
{
if(FileExists(SaveDialog1->FileName))
{
?if(Application->MessageBoxA(\\\"該文件已經存在,是否替換?\\\",\\\"信息提示框\\\",MB_YESNO)?==?6)
?{
fileHandle?=?FileCreate(SaveDialog1->FileName);
String?str?=?\\\"第一列\\\\t\\\\t第二列\\\\t\\\\t第三列\\\\t\\\\t第四列\\\\t\\\\t第五列\\\\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?=?\\\"第一列\\\\t\\\\t第二列\\\\t\\\\t第三列\\\\t\\\\t第四列\\\\t\\\\t第五列\\\\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\\\");
?}
}
}?