About File Descriptors (AutoLISP)


A file descriptor is a pointer to a file opened by the AutoLISP open function.

The open function returns this pointer as an alphanumeric label. You supply the file descriptor as an argument to other AutoLISP functions that read, write, or close the file.

You use the following functions when working with a file:

The following example opens the myinfo.dat file for reading. The open function returns a file descriptor which is stored in the file1 variable:

(setq file1 (open "c:\\myinfo.dat" "r"))
#<file "c:\\myinfo.dat">

Files remain open until you explicitly close them in your AutoLISP program. The close function closes a file. The following code closes the file whose file descriptor is stored in the file1 variable:

(close file1)