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  /
WriteString

  • WriteString[ channel , , , ... ] converts the to strings, and then writes them in sequence to the specified output channel.
  • WriteString uses the OutputForm of the .
  • WriteString allows you to create files which are effectively just streams of bytes.
  • WriteString does not put a newline at the end of the output it generates.
  • See notes for Write.
  • See the Mathematica book: Section 2.11.3.
  • Related package: Utilities`BinaryFiles`.

    Further Examples

    This opens a stream to a file tempw.

    In[1]:=

    Out[1]=

    This writes two strings to the stream.

    In[2]:=

    This writes another string to the stream.

    In[3]:=

    This closes the stream.

    In[4]:=

    Out[4]=

    Here are the contents of the file. The strings were written exactly as specified, including only the newline characters that were explicitly given.

    In[5]:=

    {arbitrary output, more output}
    yet more output