Previous: Constants, Up: File-I/O Remote Protocol Extension

#### D.14.10 File-I/O Examples

Example sequence of a write call, file descriptor 3, buffer is at target address 0x1234, 6 bytes should be written:

         <- Fwrite,3,1234,6
         request memory read from target
         -> m1234,6
         <- XXXXXX
         return "6 bytes written"
         -> F6

Example sequence of a read call, file descriptor 3, buffer is at target address 0x1234, 6 bytes should be read:

         <- Fread,3,1234,6
         request memory write to target
         -> X1234,6:XXXXXX
         return "6 bytes read"
         -> F6

Example sequence of a read call, call fails on the host due to invalid file descriptor (`EBADF`):

         <- Fread,3,1234,6
         -> F-1,9

Example sequence of a read call, user presses `Ctrl-c` before syscall on host is called:

         <- Fread,3,1234,6
         -> F-1,4,C
         <- T02

Example sequence of a read call, user presses `Ctrl-c` after syscall on host is called:

         <- Fread,3,1234,6
         -> X1234,6:XXXXXX
         <- T02