Home > Back-end >  O way! E2034 always convert 'would be *' to 'const char *'
O way! E2034 always convert 'would be *' to 'const char *'

Time:10-08

Char line [1024].

UnicodeString strMychar;

StrMychar=line + '\ 0';

If (STRCMP (strMychar SubString (3, 8) c_str (), "NEWLOG:")!=0)
{
}

CB XE, error: always convert 'would be *' to 'const char *'

How to fix, express, thanks!!!!!!


CodePudding user response:

Unicode problem
String plus L said before byte wide
Such as: L "hello";

CodePudding user response:

I'm stupid ah, where to add?

CodePudding user response:

Declarations:

WideChar * __fastcall c_str () const {return (Data)? Data: const_cast & lt; WideChar * & gt; (L ""); }

The inline int _RTLENTRYF STRCMP (const char * __s1 _FAR, const char * __s2 _FAR)
{
Return __strcmp__ (__s1 __s2);
}

CodePudding user response:

 
If (STRCMP (strMychar SubString (3, 8) c_str (), L "NEWLOG:")!=0)
{
}

CodePudding user response:

reference 4 floor zhouzhangkui response:
C/C + + code? 123 the if (STRCMP (strMychar. SubString (3, 8) c_str (), L "NEWLOG:")!=0) {}

I so tried, is still an error

CodePudding user response:

To:
 if (STRCMP (AnsiString (strMychar. SubString (3, 8)). The c_str (), "NEWLOG:")!=0) 

CodePudding user response:

Or:
 if (WCSCMP (strMychar SubString (3, 8) c_str (), L "NEWLOG:")!=0) 

Or:
 if (! SameText (strMychar SubString (3, 8), L "NEWLOG:")) 

CodePudding user response:

AnsiString

CodePudding user response:

All all, L string representation L converts a string into a unicode string
'would be *

CodePudding user response:

Top floor 6
  • Related