write

write(stream, x)

Write the canonical binary representation of a value to the given stream. Returns the number of bytes written into the stream.

You can write multiple values with the same :func:write call. i.e. the following are equivalent:

write(stream, x, y...)
write(stream, x) + write(stream, y...)

Examples

julia> file = open("foo", "w");     # create file, if doesn't exist
julia> write(fp, "Hi there!")
9
julia> close(fp);
julia> readall(fp)
"Hi there!"
julia> # write(fp, "Hi ", "there!") 
julia> # write(fp, "Hi ") + write(fp, "there!")
julia> # are also valid.

See Also

deserialize, eachline, eof, fd, flush, IOBuffer, ismarked, isopen, isreadonly, mark, nb_available, open, pipeline, position, read, read!, readavailable, readbytes, readbytes!, readline, redirect_stderr, redirect_stdin, reset, seek, seekend, seekstart, serialize, skip, skipchars, TextDisplay, unmark, write, writemime,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: