c++builder - c++ builder, label.caption, std::string to unicode conversion -


Just need to set lbl.caption (inside a loop), but the problem is that I thought that is big. I have also tried with vector vector, but there is no such thing as I've read some pages, tried some functions like widescreen (), UnicodeString (), I know that I am using Unicode C ++ Builder Can not stop or not in 2010

  std :: vector & lt; Std :: string & gt; Mystrynwek (20, ""); MyStringVec.at (0) = "Some Text"; Std :: string s = "something"; // This works .. Form 2- & gt; LL.LTDTTE1- & gt; Caption = "some simple text"; // Both lines have the same error in Form 2-> gt; LblTxtPytanie1- & gt; Caption = myStringVec.at (0); Form 2- & gt; LL.LTDTTE1- & gt; Captions = s;  

Error: [BCC32 error] myFile.cpp (12 9): E2034 'std :: string' can not be converted to 'UnicodeString'

This I ate for a few hours. Is there a "quick and dirty" solution? It's just a matter of working ...

UPDATE

Solution I have mixed STL / VCL string classes. I thank you Tommy .

The problem is that you are mixing with them. Caption property is expected to have a VCL string, which has all the functionality of STL One.

The example that works is actually passing ( const char * ), which is fine because for this VCL UnicodeString constructor in class constructor , Although there is no manufacturer to copy from STL string.

You can do one of the two things, you can use any of these in your vector, instead of the VCL string classes, there are STLs so that:

  Std :: vector & lt; Std :: string & gt; Mystrynwek (20, ""); MyStringVec.at (0) = "Some Text"; Std :: string s = "something";  

becomes:

  std :: vector & lt; String & gt; Mystrynwek (20, ""); MyStringVec.at (0) = "Some Text"; String s = "something";  

In which case the two rows below will also work. Alternatively, you can get the actual faucet containing the letter pointer from the STL string and pass it on the caption, The string class will be converted to:

  // both lines will now form 2-> will work - lblTxtPytanie1-> Caption = myStringVec.at (0) .c_str (); Form 2- & gt; LL.LTDTTE1- & gt; Caption = s.c_str ();  

The solution you want depends on you, but unless you have a specific requirement for STL string class, I strongly recommend that you use VCL String classes are going with (as I had shown for the first time). In this way you will not have two different string classes.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -