OpenAppend

OpenAppend["file"]

opens a file to append output to it, and returns an OutputStream object.

Details and Options

  • The following options can be given:
  • BinaryFormatFalsewhether to use binary format for the file
    CharacterEncodingAutomaticwhat raw character encoding to use
    FormatTypeInputFormdefault format for printing expressions
    NumberMarks$NumberMarkswhen to use ` marks in approximate numbers
    PageWidth78number of character widths per line
    TotalWidthInfinitymaximum number of character widths for a single expression
    MethodAutomaticstream method to use
  • On computer systems that support pipes, OpenAppend["!command"] runs the external program specified by command, and opens a pipe to send input to it.
  • If OpenAppend does not succeed in opening a particular file or pipe, it generates a message and returns $Failed.
  • OpenAppend resolves file names according to the procedure described in "Files and Streams".
  • OpenAppend returns OutputStream["name",n], where name is the full name of a file or command and n is a serial number that is unique across all streams opened in the current Wolfram System session.
  • SetOptions can be used to change the properties of an output stream after it is already open.
  • Functions like Put and Write automatically open the files or pipes they need, if they are not already open.
  • With the default setting BinaryFormat->False, the setting for CharacterEncoding is taken to be "ASCII".
  • With the Method option, the stream is opened using the given input stream method. This overrides the default way that OpenAppend resolves file names.
  • OpenAppend[File["file"]] is also supported.

Examples

open allclose all

Basic Examples  (1)

Create a file and write an expression to it:

Read the file:

Open the file using OpenAppend:

Write an expression and close the stream:

Read the file:

Delete the temporary file:

Scope  (1)

Write an expression to the file specified by the File object:

Wolfram Research (1988), OpenAppend, Wolfram Language function, https://reference.wolfram.com/language/ref/OpenAppend.html (updated 2016).

Text

Wolfram Research (1988), OpenAppend, Wolfram Language function, https://reference.wolfram.com/language/ref/OpenAppend.html (updated 2016).

CMS

Wolfram Language. 1988. "OpenAppend." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/OpenAppend.html.

APA

Wolfram Language. (1988). OpenAppend. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OpenAppend.html

BibTeX

@misc{reference.wolfram_2023_openappend, author="Wolfram Research", title="{OpenAppend}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/OpenAppend.html}", note=[Accessed: 16-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_openappend, organization={Wolfram Research}, title={OpenAppend}, year={2016}, url={https://reference.wolfram.com/language/ref/OpenAppend.html}, note=[Accessed: 16-April-2024 ]}