PChar - quando API retornam este |
Top Previous Next |
|
Quando temos uma API ou DLL que retorna um PCHAR porém não como resultado da função, mas sim como parametros (tipo var)
Exemplo da declaração no Help:
void Comando(char *pbuffer)
Como usar em DELPHI:
procedure Comandos(ret: PChar); stdcall; external 'ARQUIVO.DLL';
var Ret: array[1..50] of Char; I : Integer; S : String; begin Comando( @Ret ); S := ''; for I := 1 to 50 do begin if Ret[I] = #0 then Break; S := S + Ret[I]; end; end; |