Drag n drop a file and execute it

Hello
I want the user to drag and drop any file in console window and execute it with parameters
I tried something like this
1
2
3
4
5
6
7
8
#include <iostream>
#include <string>
string drop;
void main()
{
cout<<"Drag the file here and press enter:"<<endl;
cin>>drop;
system((drop).cstr()+"-p");

where drop is the string where path of the file user drops is stored and -p is parameter for it but that gives a error
I think I am doing something wrong
Can anyone point me to a right direction?
Thank you
Drag and drop is not something a console application can control because the nature of drag and drop (at least in Windows) is graphical and therefore handled by the actual console window, if at all handled (I don't know if a console accepts drops). See http://msdn.microsoft.com/en-us/library/windows/desktop/ms692464(v=vs.85).aspx for more details for Windows.

If you are programming in Linux, then I have no idea.
You can drop a file to your console application while in windows explorer and your console .exe will be executed with dropped file name as parameter.
Use argv as usual to get it.
Topic archived. No new replies allowed.