How can I check if the user entered into a folder?

Jan 25, 2009 at 1:24pm
Hey.
How can I check if the user entered into a folder (C:\Program Files for example)?

Thanks for the answers!
Last edited on Jan 25, 2009 at 1:24pm
Jan 25, 2009 at 5:09pm
I think that if you have a string like

char filename[200];

in which you keep the path of the folder the user is currently into.
Then you can just compare the strings using a code like:

int result = strcmp(filename,"C:\Program Files");

If this function returns 0(result becomes 0), means you successfully compared the strings and user has entered "C:\Program Files". If function returns a positive or negative value, then the user is not in this directory.
Jan 25, 2009 at 7:44pm
Yeah, but my question is how do I get the path of the folder the user is currently into...
Jan 25, 2009 at 7:49pm
You've not given us enough information.

Do you just want to monitor the file system and have the Operating System notify your application when the user enters a specific folder? Or do you wanna test which folder your application was run from?

http://www.cplusplus.com/forum/articles/1295/
Jan 25, 2009 at 9:46pm
Yes , I want the Operating System notify my application when the user enters a specific folder.
Jan 25, 2009 at 9:51pm
Then your best bet is to try a Win32 or Windows forum on how to hook into Explorer callbacks.
Topic archived. No new replies allowed.