# Reading files: read load

### 4.6.2 Reading files: read load

Information for Xcas can be stored in a file; this information can be read with the read or load command, depending on the type of information.

The read command reads a file containing Xcas information, such as a program that you saved (see Section 2.6.3) or simply commands that you typed into a file with a text editor. The file should have the suffix .cxx.

- read takes one argument:
  filename, the name of a file (a string) containing a saved program (see Section 2.6.3) or other commands.
- read(filename) reads the content of the file.

#### Example.

If you have a file named myfunction.cxx,
Input:

read("myfunction.cxx")

will read in the file, as long as the directory is in the current working directory. If the file is in a different directory, you can still read it by giving the path to the file,
Input:

read("/path/to/file/myfunction.cxx")

The load command reads in a saved session (see Section 2.6.1), which will end in .xws.

- load takes one argument:
  filename, the name of a file (a string) containing a saved session.
- load(filename) loads the session stored in filename.

#### Example.

If you have a session saved in the file mysession.xws,
Input:

load("mysession.xws")

loads mysession.xws.