cb017 「フォルダの操作」(04/09/15 Wed)
フォルダを作成したり削除したりそんな感じです。意外に簡単なんですねぇ。
☆フォルダの存在を確認 フォルダの作成☆
if (DirectoryExists("c:\\Test") == true){
Label1->Caption = ("テストフォルダ存在確認");
}
else{
ForceDirectories("c:\\Test");
Label1->Caption = ("テストフォルダ c:\\Test を作成しました");
}
DirectoryExists()でフォルダの存在を確認します。引数はフォルダのパスを指定。存在するならTrue、しないならFalseを返します。で、存在しない場合、ForceDirectories()でフォルダを作成しています。
☆フォルダの存在を確認 フォルダの削除☆
if (DirectoryExists("c:\\Test") == true){
int i=0;
i = RemoveDirectory("c:\\Test");
if(i == 1){
Label1->Caption = ("テストフォルダ消去");
}
else{
Label1->Caption = ("消去失敗");
}
}
else{
Label1->Caption = ("テストフォルダ存在しません");
}
DirectoryExists()でフォルダの存在を確認します。存在したらRemoveDirectory()で削除してます。
| SEO | 仕事 花 | 掲示板 レンタルサーバー プロフ SEO | |