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 > TByteDynArray型変数 を String型に変換する

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

TCP/IP通信をIndyで行おうとしていて、TByteDynArrayをString型に変換する必要があった。

以下に変換方法を見つけた。

やり取りの詳細は言語(ロシア語)が分からないため不明であるが、コードで行っていることは理解した。

実際に実装したコードは以下。

Unit1.cpp
...
	TByteDynArray byteArray;
	IdTCPClient1->Socket->ReadBytes(byteArray, len);
	String str = TEncoding::GetEncoding(932)->GetString(byteArray);
...

932のコードはSJIS。
strに文字列を取得できた。

関連 http://qiita.com/7of9/items/5a2e979961b4b01b2701

上記の処理の場合、byteArrayの途中に0x00が入っていると、そこまでの読込みしか

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?