Delphi - Convert byte array to string -


how convert byte array string (base 256) in delphi?

use built-in setstring command. sets string required length , copies bytes. there's no need array null-terminated. in fact, if array has zero--valued bytes in it, they'll correctly appear within string; won't terminate string.

setstring(ansistr, pansichar(@bytearray[0]), lengthofbytearray); 

if have unicodestring, you'll need halve length parameter since measures characters, not bytes:

setstring(unicodestr, pwidechar(@bytearray[0]), lengthofbytearray div 2); 

see also, converting tmemorystream string in delphi 2009.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -