November 2016
Intermediate to advanced
697 pages
14h 44m
English
To work with files, we need the IOStream type. IOStream is a type with the supertype IO and has the following characteristics:
names(IOStream)4-element Array{Symbol,1}: :handle :ios :name :markIOStream.types(Ptr{None}, Array{Uint8,1}, String, Int64)The file handle is a pointer of the type Ptr, which is a reference to the file object.
Opening and reading a line-oriented file with the name example.dat is very easy:
// code in Chapter 8\io.jl
fname = "example.dat"
f1 = open(fname)
fname is a string that contains the path to the file, using escaping of special characters with \ when necessary; for example, in Windows, when the file is in the test folder on the D: drive, this would become ...
Read now
Unlock full access