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.

C++ Builder XE4 > TCP > WriteLn()の誤用

Last updated at Posted at 2018-01-16
動作環境
C++ Builder XE4
String m_cmd = "command\r\n";
IdTCPClient1->Connect();
IdTCPClient1->IOHandler->WriteLn(m_cmd);

上記のような処理で予期しない結果となっていた。
以下が正解だった。

String m_cmd = "command\r\n";
IdTCPClient1->Connect();
IdTCPClient1->IOHandler->Write(m_cmd);

以下などを確認していたが、もっと単純な失敗であった。

C++ Builder / Socket > ReceiveBuf()では0x00を途中に含めた指定長さの文字列を受信する / ReadBytes()では0x00までの長さの文字列だけを受信する > ReadChar()試用 / ReadString() + memcpy()使用 > ReadStream()使用

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?