I convert string to hex, but when I convert, hex code has 2*length(string) can I do that "string length=hexstring length" is it possible?
I found this code does it work?
var
  fs: TFileStream;
  temp: Char;
  buffer: string;
  pBuffer: PAnsiChar;
  text: PAnsiChar;
begin
  fs := TFileStream.Create('file way', fmOpenRead or fmShareDenyNone);
  fs.Position := 0;
  while fs.Position < fs.Size 开发者_JAVA技巧do
  begin
    fs.Read(temp, 1); //buffer içine her defasında 1 byte gelir.
    buffer := buffer + temp;
  end;
  pBuffer := PAnsiChar(buffer);
  BinToHex(pBuffer, text, Length(buffer));
  Memo1.Text := text;
end;
The only way to do this is to map the characters to 4-bit values somehow and convert that to hex. That will mean only sixteen values are possible so, no, you can't do this in a general way if there are more than sixteen possibilities.
Eight-bit values (or any length from five to eight bits) requires two hex digits per value.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论