File Descriptors
 
 
 

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 or write to the file.

The following example opens the myinfo.dat file for reading. The open function returns the file descriptor:

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

In this example, the file descriptor is stored in the file1variable.

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)
nil