|
copyfile(a,b,1) 과
copyfile(a,b,0) 의 차이는 무엇인가요?
아래와 같이 코딩하였는데...
int i;
UnicodeString O_file, S_file, show_message;
OpenDialog1->Filter = "All files (*.*)|*.*";
if (OpenDialog1->Execute())
if (FileExists(OpenDialog1->FileName)) {
O_file = OpenDialog1->FileName;
}
else {
throw(Exception("파일을 찾을수 없다."));
return;
}
if (SaveDialog1->Execute()) {
if (FileExists(SaveDialog1->FileName)) {
show_message = SaveDialog1->FileName + "\n\n이미 존재하는 파일입니다. 덮어쓰기를 하시겠습니까?";
if (MessageDlg(show_message, mtConfirmation,TMsgDlgButtons() << mbYes << mbNo << mbCancel,0) != mrYes ) {
return;
}
}
S_file = SaveDialog1->FileName;
if (CopyFile(O_file.w_str(), S_file.w_str(), 0) == true) {
MessageDlg (SaveDialog1->FileName + "\n\n파일을 복사하였습니다.", mtInformation, TMsgDlgButtons()<<mbOK,0);
}
else {
throw(Exception(SaveDialog1->FileName + "\n\n파일을 복사할 수 없습니다. 시스템 쓰기 권한을 체크하시기 바랍니다."));
return;
}
}
============================
if (CopyFile(O_file.w_str(), S_file.w_str(), 0) == true) 부분에서
0을 붙이면 오버라이트가 되고
1을 붙이면 오버라이트가 안됩니다.
어떤 차이가 있나요?
|