This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Input and Output / File Output  /
Encode

  • Encode[" source ", " dest "] writes an encoded version of the file source to the file dest.
  • << dest decodes the file before reading its contents.
  • Encode[" source ", " dest ", " key "] produces an encoded file which must be read in using Get[" dest ", " key "].
  • Encoded files contain only printable ASCII characters. They begin with a special sequence which is recognized by Get.
  • On certain computer systems Encode[" source ", " dest ", MachineID->" ID "] can be used to generate an encoded file which can be read in only on a computer with a particular $MachineID.
  • No function is provided in Mathematica to convert encoded files back to their original form.
  • See the Mathematica book: Section 2.11.1.
  • See also: ReadProtected, $MachineID.

    Further Examples

    This creates a file in the current working directory.

    In[1]:=

    The encoded file is written to encodefile1.

    In[2]:=

    Here are the contents of the encoded file.

    In[3]:=

    (*!1N!*)mcm
    cB.!s!%!:|DC$&

    Get automatically decodes files before reading their contents.

    In[4]:=

    Out[4]=