Parameters

 filename - name or string enc - (optional) identical("utf-8","latin-1") text encoding used by filename

Description

 • The read statement is used to read Maple language files into Maple.
 • If the filename ends with the characters ".m", the file is assumed to be in Maple internal format. The objects stored in the file are read into Maple and become available for use. This functionality is not intended for end users.
 • If the file is in Maple language format, the statements in the file are read and executed as if they were being entered into Maple interactively, except that they are not echoed to the display unless interface(echo) is set to two or higher.
 • If filename contains unusual characters (such as, "/" and "."), then the name must be enclosed in quotation marks. For more information on filenames, see file.
 • The default text encoding is "utf-8".  To properly read high-ASCII characters, the proper text encoding must be chosen.  The read command also accepts encoding="latin-1" for files using the ISO/IEC 8859-1 standard.

Examples

 > $\mathrm{file}≔\mathrm{FileTools}:-\mathrm{TemporaryFile}\left("",".mpl",\mathrm{directory}='\mathrm{tempdir}'\right)$
 ${\mathrm{file}}{≔}{"/tmp/mpldoc21/yYoYxV9R.mpl"}$ (1)
 > FileTools:-Text:-WriteString(file,"hello := proc(who) cat(\"hi \",who); end;\n");
 ${40}$ (2)
 > $\mathrm{FileTools}:-\mathrm{Text}:-\mathrm{Close}\left(\mathrm{file}\right)$
 > $\mathbf{read}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{file}:$
 > $\mathrm{hello}\left("mom"\right)$
 ${"hi mom"}$ (3)

Compatibility

 • The read command was updated in Maple 2018.
 • The encoding option was introduced in Maple 2018.