WriteString

WriteString["file","string"]

writes "string" to a file.

WriteString[channel,"string"]

writes "string" to a stream or process.

WriteString[channel,expr1,expr2,]

converts the expri to strings, and then writes them in sequence to the specified output channel.

Details

Examples

open allclose all

Basic Examples  (2)

Write a string to a temporary file:

Print the file:

Delete the temporary file:

Open a stream:

Write to the stream:

Close the stream:

Print the file:

Scope  (1)

Write a string to a File object:

Print the file:

Delete the file:

Properties & Relations  (1)

WriteString does not insert line breaks after each string it writes:

Use WriteLine to automatically insert a trailing newline:

Delete the temporary file:

Introduced in 1988
 (1.0)
 |
Updated in 2003
 (5.0)
2016
 (11.0)