We have upgraded our system to latest version of MyBB. We are very sorry for the downtime ! Read More.
Advertise Here | Remove Ads

How do I open a folder/directory with C++ ?
  • 0 Vote(s) - 0 Average
Thread Closed 


Need Help How do I open a folder/directory with C++ ?
1
Hi
I want to open one of my selected folder/directory with C++. Can you guys tell me how can I do that ??



2
Open selected Folder/Directory in C programming language...
 
Code:
#include<stdlib.h>
int main()
{
    system("explorer C:\\Users");   //Here selected folder is: Users
    return 0;
}




3
Hi @Jannati
I think we should avoid system(); I will recommend not to use system for your programs. However, you can use ShellExecute(); to open a folder/directory or launch a program.
Example code :
Code:
#include <windows.h>
int main()
{
    ShellExecute(NULL,"open","C:\\Windows",NULL,NULL,SW_SHOWDEFAULT); /*it will open Windows directory form C drive. */
    return 0;
}

thanks




4
Hi and thanks @RabidHasan and @NomanProdhan

@NomanProdhan , you told that I will also can launch a program with SehllExecute(); Can you please tell me how can I do that ?

thanks in advance.



5
(05-31-2017, 01:07 AM)Jannati Wrote: Hi and thanks @RabidHasan and @NomanProdhan

@NomanProdhan , you told that I will also can launch a program with SehllExecute(); Can you please tell me how can I do that ?

thanks in advance.
Well, its so easy. Just replace the file path (C:\\Windows) with your application .exe file location. Big Grin and you are welcome. Thumbs Up







Forum Jump:


Users browsing this thread:
1 Guest(s)

Advertise Here | Remove Ads