can't be converted from 'std::string' to 'LPCSTR'

Im trying to make a file downloader with customizable path but i can't get it working

1
2
3
4
5
6

 string path;
getline (cin, path);

URLDownloadToFile(NULL,"http://parenelbullying.org/test/illuminati.exe",path,NULL,NULL);


(I translated the error code because the original version was in Spanish)

Error C2664 'HRESULT URLDownloadToFileA(LPUNKNOWN,LPCSTR,LPCSTR,DWORD,LPBINDSTATUSCALLBACK)': argument 3 can't be converted from 'std::string' to 'LPCSTR' Project1
The Windows API is designed with a C interface and doesn't understand C++'s std::string type. You just need to use path.c_str() in your call to URLDownloadToFile.
Thanks for the help but now im having 2 diferent errors

[code
URLDownloadToFile(NULL, "http://parenelbullying.org/test/illuminati.exe", path.c_str(), NULL, NULL);
][/code]

LNK2019
LNK1120
solved
Topic archived. No new replies allowed.