Visual Basic, C & C++
Delphi 분류

델파이에서 array of BYTE를 string 문자열로 변환하는 방법

컨텐츠 정보

본문

array of char의 경우는 바로 AnsiString이나 String으로 변환되지만,
array of BYTE의 경우는 char 과는 틀리게 변환하는 방법이 따로 있었습니다.

상당히 정보 검색에 어려움이 있었지만, 테스트한 결과 다음과 같이 합니다.
const
 Name_Length = 16;
var
 Name : array[0..15] of BYTE;
 strAnsiName : AnsiString;
 strName : String;
begin
  SetString(strAnsiName, PAnsiChar(@Name[0]), Name_Length);
  strName := string(strAnsiName);
end;

관련자료

댓글 0
등록된 댓글이 없습니다.
Today's proverb
우리는 유리할 때는 형제가 되고, 불리할 때는 남이 되며, 이로울 때는 친구가 되고, 해로울 때는 원수가 되는 그러한 인간관계를 증오한다. (북녘 하늘의 명언)