Results 1 to 2 of 2
i am using execv("/bin/ls", s, NULL)
Now s is a string... how do i convert it to Char * in C++
Also i have wstring...can anything b done for conversion ...
- 10-31-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 15
Convert string to Char*
i am using execv("/bin/ls", s, NULL)
Now s is a string... how do i convert it to Char * in C++
Also i have wstring...can anything b done for conversion to Char *?
- 11-01-2007 #2
There is a method for strings called c_str(). It returns, as you might guess, a C string version of the string.
As for wstrings, I don't know anything about them (I don't do much C++ programming), but I did find some documentation. I found this page very helpful:
basic_string<charT, traits, Alloc>
Basically, string and wstring are both typedefs for a special version of basic_string. As a result, I imagine that wstring also has a c_str() method, but it probably returns a wchar_t *, not a char *. You can probably find a way to use this, however.DISTRO=Arch
Registered Linux User #388732


Reply With Quote