I use TOpenDialog
to choose a file to open, and want to specify a folder with the InitialDir
property:
FILE* fp;
OpenDialog1->InitialDir= "../data";
if (OpenDialog1->Execute())
{
fp=fopen(OpenDialog1->FileName.c_str(),"r");
...
fclose(fp);
}
But, when I then use a relative path to open another file, I see that the relative path changed to the folder selected with TOpenDialog
. But I don't want TOpenDialog
to affect the relative path.
fp=fopen("AnotherFile.txt","r"); //looks in folder "data"
...
fclose(fp)
Is there any way to prevent TOpenDialog
from changing the current working path, or is the only way to save the path and then restore it?
TFileList
from win3.11 components instead ...