Open filename, read the entire contents as a string, then close the file. Equivalent to open(readall, filename).


julia> a=readall(`echo demo`)
julia> a=readall(`echo hello`)
julia> (chomp(a)) == "hello"

Reading a text file that says hello world

julia> cd("C:\\temp\\julia");
julia> f = open("hello.txt");
julia> s = readall(f);
julia> s
"hello world!"

Reading a CSV File and splitting it

julia> file = open("data.csv");

julia> strings = readall(file);

julia> data = split(strings, "\r\n");

julia> data
4-element Array{SubString{ASCIIString},1}:

See Also

abspath, basename, chmod, countlines, cp, ctime, dirname, download, evalfile, expanduser, fdio, filemode, filesize, functionloc, gperm, homedir, include_string, isabspath, isblockdev, ischardev, isdir, isdirpath, isexecutable, isfifo, isfile, islink, ismount, ispath, isreadable, issetgid, issetuid, issticky, iswritable, joinpath, less, lstat, mkdir, mkpath, mktemp, mktempdir, mtime, mv, normpath, operm, poll_fd, poll_file, readall, readcsv, readdir, readdlm, readlines, readlink, realpath, relpath, rm, splitdir, splitdrive, splitext, stat, symlink, tempdir, tempname, touch, truncate, uperm, watch_file, writecsv,

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

Checking you are not a robot: