delphi小问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 03:52:06
program Project2;

{$APPTYPE CONSOLE}

uses
SysUtils, windows;

Var WinDir ,currDir:Pchar ;

begin
New(WinDir); //Allotment memory space
New(currDir); //Allotment memory space
GetWindowsDirectory(WinDir,255); //Install the catalogue to the windows to put WinDir
WinDir
GetCurrentDirectory(255,currDir); // Put the current catalogue to the currDir
WriteLn('The Windows system document catalogue be: ' ,WinDir); //the result
WriteLn('the document cataogue is :' ,CurrDir); //the result
//Dispose(WinDir);
//Dispose(currDir);
ReadLn;

end.

=======================
出现问题 大家帮忙
Missing operator or semicolon

如何解决??

给你一个简单的写法

var
WinDir : array[0..MAXPATH] of Char;
curDir : array[0..MAXPATH] of Char;

begin
GetSystemDirectory(WinDir, MAX_PATH);
GetCurrentDirectory(MAX_PATH, curDir);
WriteLn('The Windows system document catalogue be: ' ,WinDir);
WriteLn('the document cataogue is :' ,CurrDir);
end;