Set the file pointer.


First available in version 3.7 build 197.

Input Parameters:

offset - Desired offset in bytes from the beginning of the file.

Output Parameters:

systemError - A system specific error code from the GetLastError function.

Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.BinaryFile.setFilePointer( paramsObject [, callbackParamsObject] [, errorParamsObject] );

Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.BinaryFile.setFilePointer( paramsObject );


It is legal to set the file pointer past the physical end of file but the file size will not change until you write bytes to the file. A writeBytes operation will increase the size of the file to the file pointer position plus the size of the data written, leaving the intervening bytes uninitialized.

To add data to the end of a file, use getSize to find the current size of the file and then use setFilePointer to reposition the file pointer to the end of the file before writing the new data.



Create a new file, write some data to it then close it, re-open it and append more data to the end of the file.

ssCore.BinaryFile.create({path:"startdir://test.dat", accessMode:"write", failIfExists:"false"});
ssCore.BinaryFile.writeBytes({data:"old data", format:"utf8"});
ssCore.BinaryFile.close({});{path:"startdir://test.dat", accessMode:"write"});
r = ssCore.BinaryFile.getSize({});
eof = r.result;
ssCore.BinaryFile.writeBytes({data:"new data", format:"utf8"});