A
arssa2020
hello all,
ms visual studio 2003,
i need to read serial bytes (one byte at a time) from serial port, and
the catenate it to a char* (cannot use strings)
strcat require that the 2nd parameters (the src)to be of type
const char*.
so i cast the (char byte) to be a (char*)
i have the following code
char byte;
char s[128]
.....
//read serial data from serial port
ReadFile (hPort, &byte, 1, &dwBytesTransferred, 0);
....
if(byte !=0x0D) //CR
{
//append the received byte to the string s
strcat(s,(char*)byte)
}
//it gives me access violation
"Unhandled exception at 0x00420601 in Test.exe: 0xC0000005: Access
violation reading location 0x00000047."
how can i go around it?
i cannot use string class members..
thanks
ms visual studio 2003,
i need to read serial bytes (one byte at a time) from serial port, and
the catenate it to a char* (cannot use strings)
strcat require that the 2nd parameters (the src)to be of type
const char*.
so i cast the (char byte) to be a (char*)
i have the following code
char byte;
char s[128]
.....
//read serial data from serial port
ReadFile (hPort, &byte, 1, &dwBytesTransferred, 0);
....
if(byte !=0x0D) //CR
{
//append the received byte to the string s
strcat(s,(char*)byte)
}
//it gives me access violation
"Unhandled exception at 0x00420601 in Test.exe: 0xC0000005: Access
violation reading location 0x00000047."
how can i go around it?
i cannot use string class members..
thanks