Question and Answer Database FAQ2591D.txt Calling DeleteFile function Category :Object Pascal Platform :All Product :All 32 bit Question: I want to call the Windows DeleteFile() function, but I get the error "Incompatible types: 'string' and 'Pointer'" when compiling. How can I get around this? Answer: The DeleteFile() procedure is declared both in the SysUtils unit and the Windows unit. The following example demonstrates calling both procedures. The version declared in the SysUtils unit accepts strings, and the Windows version accepts PChars. procedure TForm1.Button1Click(Sender: TObject); var s : string; a : array[0..MAX_PATH — 1] of char; begin s := 'C:\SomeFile'; SysUtils.DeleteFile(s); a := 'C:\SomeFile'; Windows.DeleteFile(@a); end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99