May 14, 2012 at 7:07am UTC
How can i add string array into character buffer;
I want that
buff[0]=str2[0];
buff[1]=str2[1];
but it shows error
Non Portable string conversion
May 14, 2012 at 9:00am UTC
The code you showed is valid. So it is interesting what error did you get?
If str2 has type std::string and buff is defined as a character array then you can use standard function std::strcpy from <cstring>. For example
std::strcpy( buff, str2.c_str() );
Last edited on May 14, 2012 at 9:06am UTC
May 14, 2012 at 9:36am UTC
vlad from moscow wrote:
The code you showed is valid.
This isn't true. There is only one truth. And the truth is, what the compiler says.
And char is something different to wchar, which you might get maybe - I don't know - by str2[0].
You can't convert a value of 24657 to a value in the range of 0 to 255. How would you do this?
What you could use, is:
Marshal::StringToHGlobalAnsi
Last edited on May 14, 2012 at 9:37am UTC