[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KExtendedSocket: putch sends int instead of char
From:       Erik Sigra <sigra () home ! se>
Date:       2002-01-30 12:38:43
[Download RAW message or body]

Monday 28 January 2002 23.51 skrev Thiago Macieira:
> If you have problems using the KDE socket API, let me know. (Constructive)
> Criticism and bug reports are also welcome.

I found a strange thing. The functions "int getch ()" and "int putch (int ch)" 
are quite strange. Their names indicate that they should work with 
characters, but the types are integers. This mess seems to be inherited from 
QIODevice.

It seems like "int getch ()" really only removes a character from the stream, 
as it should. Is this correct?

But "int putch (int ch)" sends an integer. The first byte will contain the 
intended character and the other 3 bytes will contain garbage, in this case 
"Ìëÿ" (204, 235, 255). This causes problems at the other end of the 
connection. My test program had to skip 3 characters after each read. This 
seems like an annoying bug.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic