1
When executing a C++ code these two problems occur:
- [BCC32 Error] USerialCommunication.cpp(96): E2034 Cannot convert 'wchar_t *' to 'const char *'
- [BCC32 Error] USerialCommunication.cpp(96): E2342 Type mismatch in parameter '__src' (wanted 'const char *', got 'wchar_t *')
Source Code:
void __fastcall TFSerialPort::EnviarClick(TObject *Sender)
{
char buff[100];
//Converte uma string em array.
strcpy(buffer, EdCommand->Text.c_str());
}
Statement by Edcommand: TEdit *EdCommand;
Buffer declaration: char buffer[100];
Error occurs on the line of strcpy
.
Note: The source code was made in C++ Builder 6 and I am trying to run in Embarcadero XE2
No, the statement of buffer is
char buff[100];
and the call fromstrcpy
isbuffer
. Possibly the error is there. What is the type of propertyTEdit->Text
. The error may be inc_ str
.– Maniero
Actually this char Buff[100] statement is correct. The char buffer[100] variable is outside this code. The error solution posted below, after a while I managed to resolve. Thank you so much for the help.
– Giovani