Robby
2006-06-24 04:51:01 UTC
Hi,
I have the following line of code which reads bytes from an rs232 port:
Please consider the following code:
============================================
DWORD dwBytesRead = 0;
BYTE abBuffer[100];
TCHAR szBuffer[100];
MySerial.Read(abBuffer,sizeof(abBuffer),&dwBytesRead);
============================================
Now, I need to print abBuffer to the screen, god knows I tried !
TextOut(hdc,100,100,abBuffer,100); //no good!
TextOut(hdc,100,100,TEXT(abBuffer),100); // no good!
TextOut(hdc,100,100,(char)abBuffer,100); //I didn't expect this one
to work!
TextOut(hdc,100,100,wsprintf(szBuffer,TEXT("%s")),abBuffer); //Forget it!
:(
By now I have looked for answers in Petzold, Osborn and SAM's books and I
now need help! >>>> a g a i n!
Anyone!
BYTE is typedefed in Windows as so,
typedef unsigned char BYTE;
-so this tells me that a byte is really defined as a char... right ?
-A char is 8 bits ... right ?
So if the 4th parameter of TextOut takes a LPCTSTR, then how would I convert
this so that TextOut would accept it ?
Ooooohhhhfffff !
Anyone.....Please!
I have the following line of code which reads bytes from an rs232 port:
Please consider the following code:
============================================
DWORD dwBytesRead = 0;
BYTE abBuffer[100];
TCHAR szBuffer[100];
MySerial.Read(abBuffer,sizeof(abBuffer),&dwBytesRead);
============================================
Now, I need to print abBuffer to the screen, god knows I tried !
TextOut(hdc,100,100,abBuffer,100); //no good!
TextOut(hdc,100,100,TEXT(abBuffer),100); // no good!
TextOut(hdc,100,100,(char)abBuffer,100); //I didn't expect this one
to work!
TextOut(hdc,100,100,wsprintf(szBuffer,TEXT("%s")),abBuffer); //Forget it!
:(
By now I have looked for answers in Petzold, Osborn and SAM's books and I
now need help! >>>> a g a i n!
Anyone!
BYTE is typedefed in Windows as so,
typedef unsigned char BYTE;
-so this tells me that a byte is really defined as a char... right ?
-A char is 8 bits ... right ?
So if the 4th parameter of TextOut takes a LPCTSTR, then how would I convert
this so that TextOut would accept it ?
Ooooohhhhfffff !
Anyone.....Please!
--
Best regards
Roberto
Best regards
Roberto