Using Delphi 7:
Simple situation, I want to typecast raw data using a buffer pointer and buffer length. I'm mainly looking for chars though it will be intermingled with other types. Since #0 termination byte may be in raw data, typecasting to PChar is unreliable, is there any other way to do this without iterating byte by byte. The buffer ranges from bytes to megabytes so I'm looking for something fast.
procedure GimmeData(pBuf: pointer; iBuffLen: word);
TBufData = array of byte;
PTBufData = ^TBufData;
BufData := pBuf;
output(PChar(BufData^));//if only it were that easy