convert _TCHAR* argv[] to char

Joined
Sep 18, 2009
Messages
2
Reaction score
0
Hi Everybody,

I need to convert _TCHAR to char. Trying to run:
Code:
// winXP; MSVC++2008Pro
int _tmain(int argc, _TCHAR* argv[])
{...
	// convert _TCHAR* argv[] to char
	wstring s = argv;
	//convert from wchar to char
	const wchar_t* wstr = s.c_str();
	size_t wlen = wcslen(wstr) + 1;
	char newchar[100];
	size_t convertedChars = 0;
	wcstombs_s(&convertedChars, newchar, wlen, wstr, _TRUNCATE);

	error = NotesInitExtended(argc, newchar);
....
}
but it gives me the error:
Code:
 error C2440: 'initializing' : cannot convert from '_TCHAR *[]' to 'std::basic_string<_Elem,_Traits,_Ax>'
Any suggestions?:captain:

All comments are welcome.:beer:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top