File.setPosition()

NES2+Syntax

							file.setPosition(num)
file.setPosition(num, refPoint)

Description

The setPosition() method of the File object sets the pointer's position to a relative num location in the file. By default, this is relative to the beginning of the file, but you can pass a reference point to determine where this relative location is located. The possible values of this reference point are listed in Table 8.17.

Table 8.17. Possible Values of the Reference Point
ValueDescription
0Sets the pointer relative to the beginning of the file
1Sets the pointer relative to the current pointer position
2Sets the pointer relative to the end of the file

Example

Listing 8.85 uses the setPosition() method to access every other character in the ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.