Thank you very much for your appreciated help. Now I want to remove the path from the filename I got from the Browse button. I shall tell you of a way I tried to use (before I read your second reply). I used system ( "cd >> dir" ) to get the program's path, read it in a buffer and then compared it to the first characters in the filename. To take out the path, here is the code I used:
for (short i = 0; i < length; i ++)
if ( FileName.GetAt(i) != path.GetAt(i) ) { i=-1; break; }
if (i == -1) break;
for (short j = 0; i <= FileName.GetLength(); i ++, j++)
FileName.SetAt (j, FileName.GetAt(i) );
This part of code was inside a loop, and length is the length of the path of the program. FileName is the buffer in which I stored the filename from the browse button. The problem with the above code is that it doesn't work when the program is at the root folder of a partition. What do you think is the reason? I am thinking of using a similar code (with GetModuleFileName instead of system ( "cd >> dir" ). But shouldn't this give me the same problem? If you find that my method was faulty somehow, please tell me. Again thank you for your help.
Hosam Aly Mahmoud