hi,
I have been wondering how to convert a system::string from a form text box into a character array i have,
Thanks dave
do you mind explaining how that works please.
this is what i want to ultimatly acheive: char text[10]=textBox2->Text;
however as you know that would send me an error so i was wondering how it could be done
I use another C language for pic's that require the use of char arrays so i need to be brought up to date this is my code:
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 31 32
|
DCB dcb = {0};
DWORD byteswritten;
char text[10]=textBox2-Text;
LPCVOID pointer = &text;
HANDLE hPort = CreateFile( L"COM4",
GENERIC_READ|GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if(hPort==INVALID_HANDLE_VALUE)
{
label8->Text="Invalid Handle";
}
if (!GetCommState(hPort,&dcb))
{
label8->Text="Error";
}
dcb.BaudRate = CBR_19200; //19200 Baud
SetCommState(hPort,&dcb);
bool retVal = WriteFile(hPort,pointer,10,&byteswritten,NULL);
CloseHandle(hPort);
|
please advise on how i can convert the system::string into a wchar_t and still be able to retreive a pointer for the writefile function,
before you ask no this isn't a homework project, just me messing around with the com ports and come to a bit of a halt,
i appreciate your help,
Dave
Last edited on