|
-
December 9th, 2003, 02:01 PM
#1
Sending uncoded zero (ASCI) data on RS232
I want to send uncoded (ASCII) numbers over the RS232 interface. I'm having problem with sending the number 0. Since this termitaes the string that I'm trying to send.
int zero = 0;
char h = 'h';
char e = 'e';
Meddelande.Format("%c%c%c", h, zero, e);
MeddelandeStorlek = Meddelande.GetLength();
length = tmpStr.GetLength();
CheckWrite = WriteFile(Port, (LPCSTR)Meddelande,
MeddelandeStorlek, Bitskickade, NULL);
Since zero will terminate the string e is never sent.
How do I get around the termination function of NUL?
-
December 9th, 2003, 02:13 PM
#2
Is there any reason why you can't send a memory block? So for the simple case:
Code:
char buf[16]; // just for example; could be allocated
buf[0] = 'h';
buf[1] = 0;
buf[2] = 'e';
length = tmpStr.GetLength();
CheckWrite = WriteFile(Port, (LPCSTR)buf,
3, Bitskickade, NULL);
bytz
--This signature left intentionally blank--
-
December 9th, 2003, 02:15 PM
#3
OK,
I try to do it this way.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|