bonjour,
J'essaye de dire à une chaine qu'elle est plus long que 213 caractères.
J'ai codé
il y a deux appels à de primitives de basic_string L'appel de max_size() et l'appel de capacity()
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 void CInterbaseManagerM::Display( Exception^ exception) { char ErrorString[2048]; std::string ErrorStr; std::string terme1; std::string terme2; std::string terme3; std::wstring wsName; char* ErrorT; const wchar_t* chars; int len; terme1 = "Index #"; terme2 = "\n"; terme3 = "Error: "; System::String^ ErrorText = exception->Message; chars = (const wchar_t*)(Marshal::StringToHGlobalUni( ErrorText)).ToPointer(); wsName.append( chars); ErrorT = CStrConv::awcstombs( (wchar_t*)chars); Marshal::FreeHGlobal(IntPtr((void*)chars)); int maxSize = 300; maxSize = ErrorStr.max_size(); int CurrSize = ErrorStr.capacity(); ErrorStr = terme1 + terme2 + terme3; len = ErrorStr.size(); ErrorStr = ""; ErrorStr += ErrorT + terme2; CStrConv::StrFreeA( ErrorT); edit( (char*)ErrorString); }
mais ces appels ne donnent pas le bon résultat
Partager