L3DT users' wiki
Large 3D terrain generator

fseek

Description

Reposition a file file handle within a file stream.

Function prototype

bool fseek <voidptr:hFile> <int64:Offset> <int:Origin>

Arguments

Name Type Comment
hFile voidptr A handle to an open file.
Offset int64 Number of bytes to offset from Origin.
Origin int Position from where Offset is added. Supported values are 0 (SEEK_SET), 1 (SEEK_CUR) and 2 (SEEK_END). Please refer to C++ fseek documentation for more information.

Return value

True if success, false otherwise.

Example

// open a file, fseek forward, then ftell position

// open file
voidptr fp
assert <zs:fopen_s fp "C:\\test.txt" "r"> "Could not open file!"

// fseek to 10
assert <zs:fseek fp 10 0> "Fseek failed!"
echo <zs:ftell fp> // should be at 10 now

// close
fclose fp

… the output of which is written to the event log by echo as:

10

Comments

None.

See also

 
plugins/general/zeoscript/reference/functions/fseek.txt · Last modified: 2017/08/31 06:43 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki