在 openge 目录中编译文件的程序
Program to compile files in a directory in openedge
谁能帮我写一个程序,它必须编译目录中的所有文件并报告错误,如果有的话。为此,我的程序必须获取文件夹下所有文件的列表及其完整路径,并将其存储在 temp-table 中,然后它必须遍历 temp table 并编译文件。
下面是一个非常粗略的开始。
在联机帮助 (F1) 中查找有关 COMPILE 语句和 COMPILER 系统句柄的更多信息。
请注意,编译需要安装开发人员许可证。没有它,COMPILE 语句将失败。
DEFINE VARIABLE cDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO FORMAT "x(30)".
ASSIGN
cDir = "c:\temp\".
INPUT FROM OS-DIR(cDir).
REPEAT:
IMPORT cFile.
IF cFile MATCHES "*..p" THEN DO:
COMPILE VALUE(cDir + cFile) SAVE NO-ERROR.
IF COMPILER:ERROR THEN DO:
DISPLAY
cFile
COMPILER:GET-MESSAGE(1) FORMAT "x(60)"
WITH FRAME frame1 WIDTH 300 20 DOWN.
END.
END.
END.
INPUT CLOSE.
由于评论不允许我将这么多内容粘贴到其中...使用 INPUT FROM OS-DIR returns 目录下的所有文件和目录。您可以使用此信息继续沿着目录树向下查找所有子目录
OS-DIR documentation:
Sometimes, rather than reading the contents of a file, you want to read a list of the files in a directory. You can use the OS–DIR option of the INPUT FROM statement for this purpose.
Each line read from OS–DIR contains three values:
*The simple (base) name of the file.
*The full pathname of the file.
*A string value containing one or more attribute characters. These characters indicate the type of the file and its status.
Every file has one of the following attribute characters:
*F — Regular file or FIFO pipe
*D — Directory
*S — Special device
*X — Unknown file type
In addition, the attribute string for each file might contain one or more of the following attribute characters:
*H — Hidden file
*L — Symbolic link
*P — Pipe file
The tokens are returned in the standard ABL format that can be read by the IMPORT or SET statements.
谁能帮我写一个程序,它必须编译目录中的所有文件并报告错误,如果有的话。为此,我的程序必须获取文件夹下所有文件的列表及其完整路径,并将其存储在 temp-table 中,然后它必须遍历 temp table 并编译文件。
下面是一个非常粗略的开始。
在联机帮助 (F1) 中查找有关 COMPILE 语句和 COMPILER 系统句柄的更多信息。
请注意,编译需要安装开发人员许可证。没有它,COMPILE 语句将失败。
DEFINE VARIABLE cDir AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO FORMAT "x(30)".
ASSIGN
cDir = "c:\temp\".
INPUT FROM OS-DIR(cDir).
REPEAT:
IMPORT cFile.
IF cFile MATCHES "*..p" THEN DO:
COMPILE VALUE(cDir + cFile) SAVE NO-ERROR.
IF COMPILER:ERROR THEN DO:
DISPLAY
cFile
COMPILER:GET-MESSAGE(1) FORMAT "x(60)"
WITH FRAME frame1 WIDTH 300 20 DOWN.
END.
END.
END.
INPUT CLOSE.
由于评论不允许我将这么多内容粘贴到其中...使用 INPUT FROM OS-DIR returns 目录下的所有文件和目录。您可以使用此信息继续沿着目录树向下查找所有子目录
OS-DIR documentation:
Sometimes, rather than reading the contents of a file, you want to read a list of the files in a directory. You can use the OS–DIR option of the INPUT FROM statement for this purpose.
Each line read from OS–DIR contains three values:
*The simple (base) name of the file.
*The full pathname of the file.
*A string value containing one or more attribute characters. These characters indicate the type of the file and its status.
Every file has one of the following attribute characters:
*F — Regular file or FIFO pipe
*D — Directory
*S — Special device
*X — Unknown file type
In addition, the attribute string for each file might contain one or more of the following attribute characters:
*H — Hidden file
*L — Symbolic link
*P — Pipe file
The tokens are returned in the standard ABL format that can be read by the IMPORT or SET statements.