Write to a File 0x2222 87 65

Writes a block of data to a file.

NetWare Servers:6.x

Request Format

Offset

Content

Type

Request header

6

FunctionCode (87)

byte

7

SubFunctionCode (65)

byte

8

FileHandle

long (Hi-Lo)

12

StartingByteOffset

UINT64 (Hi-Lo)

20

BytesToWrite

word (Hi-Lo)

22

Data

byte[BytesToWrite]

Return Values

Decimal

Hex

Description

0

0x00

Successful

131

0x83

Hard I/O Error

136

0x88

Invalid File Handle

148

0x94

No Write Privileges

149

0x95

File Detached

162

0xA2

I/O Lock Error

253

0xFD

Bad Station Number

255

0xFF

I/O Bound Error

Remarks

Note that StartingByteOffset in the request can be 64 bits. Requests made to NSS volumes support writing at true 64-bit offsets. Requests made to traditional volumes support writing at 32-bit offsets. Writing at offsets greater than 32 bits on a traditional volume result in an error.

If you do not have write access to the specified file or if some portion of the targeted byte block is locked for use by a different client, Write to a File will fail.

You are constrained by the current negotiated file buffer size (see Negotiate Buffer Size 0x2222 33). You cannot write more bytes of data than will fit in the buffer size. Also, you cannot write a data block that straddles a buffer size 4 KB boundary in the file.

For example, if the current buffer size were 4,096 bytes and you want to write 4,200 bytes, starting at file offset 4000, you must issue three write requests. The first request would write 96 bytes starting at offset 4000. The second request would write 4,096 bytes starting at offset 4,096. The last request would write 8 bytes starting at offset 8,192.

If you do not write any bytes at postion zero, the files will be truncated.

FileHandle, StartingByteOffset, and BytesToWrite require the input to be in Hi-Lo order.

See Also

Negotiate Buffer Size 0x2222 33, Read File 0x2222 87 64