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

silverlight - Applying a style to ItemContainerStyle in C# -

php - Retrieving comment count from fb:comments widget (Facebook) -

c# - NullReferenceException in MySqlClient.NativeDriver -