Asymptote/File IO
This section contains a discussion of the various file manipulation capabilities of Asymptote. It covers image files outputs, source code includes and data file input and output.
Image Files
editImage files are created by calling the shipout function. However, this need not be explicitly included.
Source Files
editMany useful modules, as discussed in the Asymptote main page, can be imported using the file import routine; for example:
import graph.asy;
would give access to the numerous graphing functions contained in the file graph.asy.
According to the software documentation (http://asymptote.sourceforge.net), Asymptote will search for module files in the following directories (in order):
- The current directory;
- The directory .asy in the user’s home directory (%USERPROFILE%\.asy under MSDOS);
- A list of one or more directories specified by the configuration variable dir (separated by : under UNIX and ; under MSDOS);
- The Asymptote system directory (by default, /usr/local/share/asymptote under UNIX and C:\Program Files\Asymptote under MSDOS).
The working directory can be changed using the command
string cd(string directory_string);
The return value is the new directory. If directory_string is an empty string, the system returns to the working directory at startup. Note: the option -global or -unsafe must be enabled to change the working directory.
Data Files
editData files can be input and output