On my MFC application I read file and do some process on it. Here is the code I used to open and read only.

CFile srf_ReadFile;
char * srf_FilePath = "ReadFile_001.txt";
if(srf_ReadFile.Open(srf_FilePath, CFile::modeRead))
// Do the required process here on ReadFile_001.txt

So, the file should be always in the same folder which the project/solution contain. If I want to read another file, say ReadFile_002.txt, have to do it manually, go to the code and gives the new file name.

char * srf_FilePath = "ReadFile_002.txt";

It is too boring. So I want to make it more reliable to use. I want to add a browse button(I think that is the correct word, which is used to find the file in Windows) and set it as the file which I want to read.

How can I do it. Can you guys explain.

Recommended Answers

All 2 Replies


But I cant change my code now for fstram. Have to do lots of modifications.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.