std::string to LPCSTR

Hi all! I write console FTP client and use WinInet.h. One of the InternetConnect function's parameter is LPCSTR lpszServerName. But i transfer string argument.
For examle:
HINTERNET ConnectParam=InternetOpen(hInternet,"ftp.vladsserver.ru",port,"login","pas",INTERNET_SERVICE_FTP,INTERNET_FLAG_PASSIVE,0);
But i have an error. How I can convert std:string to LPCSTR? I hope you can help me.
PS: Sorry for my English - i'm from Kazakhstan and English is not my native language:)
Last edited on
mutexe, thank you. But can you give me little example?
There's some in that link.
Just google your thread title for more examples.
1
2
	std::string newString("wibble");
	LPCTSTR oldString = newString.c_str();


then pass in to your method.
I found this!
MyString.c_str();
exactly.
- Wait, are you trying to convert a string to a constant string pointer? Interesting.
Last edited on
Topic archived. No new replies allowed.