FormatPath

Delphi

29/09/2005

Erro ao compilar a função abaixo:


Function TForm1.ExtractTempDir : String;
Var
Buffer : Array[0..144] of Char;

Begin
GetTempPath(144,Buffer);
Result := FormatPath(StrPas(Buffer));
End;


O problema está em FORMATPATH, em qual unit está declarado, o Delphi 6 não reconhece.

Obrigado


Airoosp

Airoosp

Curtidas 0

Respostas

Andrew Vargas

Andrew Vargas

29/09/2005

A pessoa que te passou o código, se esqueceu da função FormatPath, ela não está declarada em nenhuma unit, ela é implementada na mão mesmo.

function FormatPath(Path: string): string;
const DirSep: char = {$ifdef Unix}'/'{$else}'\'{$endif};
var P: integer;
SC: char;
begin
if ord(DirSep)=ord('/') then
SC:='\'
else
SC:='/';

repeat
P:=Pos(SC,Path);
if P>0 then Path[P]:=DirSep;
until P=0;
FormatPath:=Path;
end;
GOSTEI 0
Valquiria Silva

Valquiria Silva

29/09/2005

Ou vc pode tentar conforme sugestão desse link

Function ExtractTempDir : String;
Var
    Buffer : Array[0..144] of Char;
Begin
    GetTempPath(144,Buffer);
    Result := IncludeTrailingBackSlash(StrPas(Buffer));
End;
GOSTEI 0
POSTAR