Michael Piepers homepage
BeOS Programs
PalmBeach
PSION Link Protocol description
RFSV Protocol description

RFSV command FSEEK


Description of command

The command FSEEK positions the file pointer on an indicated position within an opened file. There are various possibilities the position to determine. The command only works without an error, if the file was opened with the parameter FRANDOM set in the command FOPEN!

It is to be noted that; all values, which are more greater than 8 bits in reverse order will transfer. The LOW byte sent as the first over the line and only then follows the HIGH byte!


Transmission direction (command) in the interface format

The instruction FSEEK is built into the PLP as shown in the following table:

Header PLP RFSV FSEEK Footer CRC
16 10 02 32 03 02 01 Command
0c 00
Size
08 00
File handle
01 00
Position
00 00 00 00
Mode
02 00
10 03 12 34

Receipt direction (result) in the interface format

A valid response takes place with the command RESPONSE and returns the delivery an error code.

Header PLP RFSV RESPONSE Footer CRC
16 10 02 33 02 03 01 Command
2a 00
Size
06 00
Result
00 00
current position
bc 04 00 00
10 03 12 34
bold Values represent fixed of values, which are used accurately in such a way!
italic Values represent examples, which have a different meaning on the basis the instruction.

Description of command

The command FSEEK consists of 5 information units. These have the following meanings:

Length in byte possible values Meaning
Command 2 byte 00 0c (fixed) The command identifier has always the same value!
Size 2 byte 00 08 (fixed) Always eight bytes will transfer.
File handle 2 byte variable The File handle is to be transferred, which the calling program with the Command FOPEN received.
Position 4 byte variable Dependent on the mode this value is interpreted different. It always indicates a length in bytes. Starting from which position this is however counted, results from contents of mode.
Mode 2 byte variable This value indicates, how the byte length in position is to be regarded. The following values are possible:
P_FABS 00 01 Position absolute of the start of the file
P_FEND 00 02 Position absolute of the end of the file
P_FCUR 00 03 Position absolute of the current position of the file pointer
P_FRSENSE 00 04 SENSE the records position
P_FRSET 00 05 Set the records position
P_FREWIND 00 06 Rewind a text file

Description of result

The command FSEEK is answered with RESPONSE. This returns the delivery as result an error code and the current position within files as absolute value of the start the file.

Length in byte possible values Meaning
Command 2 byte 00 2a (fixed) The command identifier has always the same value!
Size 2 byte 00 02 (fixed) Always 2 additional byte are supplied!
Result 2 byte variable The result can obtain the following values:
E_FILE_INV ff d3 -45 Invalid IO-Function. Appears, when the file wasn't opened with FRANDOM!
NO_ERROR 00 00 00 No error occurred
You can look at all defined errorvalues.
Position 4 byte variable The absolute position is indicated in bytes, at which the file pointer is after the command.

Michael Piepers homepage
BeOS Programs
PalmBeach
PSION Link Protocol description
RFSV Protocol description

Last modification Jan 31 1999 by Michael Pieper