0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Link > -32(0xE0)をTCP/IPで受信した時に63(0x3F)になる事象

Last updated at Posted at 2017-02-14
動作環境
C++ Builder XE4

http://qiita.com/7of9/items/9fa80d146d3fab63a71b
において、TCP/IPの受信方法をTClientSocketからIndy使用に変更していてうまくいっていない。

問題は-32(0xE0)c-22(0xEA)といった値が0x3Fとして受信されてしまう部分。

以下に関連しそうな記事を見つけた。
https://social.msdn.microsoft.com/Forums/en-US/411ccdeb-63c3-4fda-8a6a-f86dd1352e4a/how-to-convert-the-byte-255-to-a-signed-char-in-c?forum=csharplanguage

For example ASCII only allows byte values < 128, anything >= 128 will be converted to a '?'.

byteで受信した文字列をsigned charに変換しようとして失敗している。

byteで受信した文字列はそのままbyteで扱うのがいい、とのことらしい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?