
CHAPTER 3: File System Access File object 55
seek()
fileObj.seek (pos[, mode])
pos
The new current position in the file as an offset in bytes from the start, current
position, or end, depending on the
mode.
mode
Optional. The seek mode, one of:
X 0: Seek to absolute position, where pos=0 is the first byte of the file. This is the
default.
X 1: Seek relative to the current position.
X 2: Seek backward from the end of the file.
Seeks to the specified position in the file. The new position cannot be less than 0 or greater than the
current file size.
Returns true if the position was changed.
tell()
fileObj.tell ()
Retrieves the current position as a byte offset from the start of the file.
Returns a number, the position index.
write()
fileObj.write (text[, text...]...)
text
One or more strings to write, which are concatenated to form a single string.
Writes the specified text to the file at the current position. For encoded files, writing a single
Unicode character may write multiple bytes.
N
OTE: Be careful not to write to a file that is open in another application or object, as this can
overwrite existing data.
Returns true on success.
writeln()
fileObj.writeln (text[, text...]...)
text
One or more strings to write, which are concatenated to form a single string.
Writes the specified text to the file at the current position, and appends a Line Feed sequence in the
style specified by the
linefeed property.For encoded files, writing a single Unicode character may
write multiple bytes.
N
OTE: Be careful not to write to a file that is open in another application or object, as this can
overwrite existing data.
Returns true on success.
Comentários a estes Manuais