can I easily check for the existance of a certain file?
with VB would just use Dir(FileName), an empty string returned would indicate that the file doesnt exist. Can I do something similar with C++?
Printable View
can I easily check for the existance of a certain file?
with VB would just use Dir(FileName), an empty string returned would indicate that the file doesnt exist. Can I do something similar with C++?
use the undocumented SHFileExists function.
here is the declaration in vb, if you can convert it to C++ good luck!
Code:Private Declare Function SHFileExists Lib "shell32" Alias "#45" (ByVal szPath As String) As Long
Put this in to the OnClick Event of some control
I hope this works!:)Code:AnsiString asFileName = FileSearch(Edit1->Text, GetCurrentDir());
if (asFileName == "")
Application->MessageBox(("Couldn't find " + Edit1->Text + ".").c_str(), "FileSearch Example", IDOK);
else
Application->MessageBox(("Found " + asFileName + ".").c_str(), "FileSearch Example", IDOK);