next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: fileLength

fileLength -- the length of a file

Synopsis

Description

The length of an open output file is determined from the internal count of the number of bytes written so far.

i1 : f = temporaryFileName() << "hi there"

o1 = /tmp/M2-63438-0/0

o1 : File
i2 : fileLength f

o2 = 8
i3 : close f

o3 = /tmp/M2-63438-0/0

o3 : File
i4 : filename = toString f

o4 = /tmp/M2-63438-0/0
i5 : fileLength filename

o5 = 8
i6 : get filename

o6 = hi there
i7 : length oo

o7 = 8
i8 : removeFile filename

See also

For the programmer

The object fileLength is a compiled function.