Next Previous Contents

## 2. Reading and writing sectors

The read and write functions are:

> `

>         unsigned char __fastcall__ dio_read (dhandle_t handle,
>                                              sectnum_t sect_num,
>                                              void *buffer);

> `

This function will read the sector specified by `sect_num` into the memory location at buffer.

> `

>         unsigned char __fastcall__ dio_write (dhandle_t handle,
>                                               sectnum_t sect_num,
>                                               const void *buffer);

> `

This function will write the memory contents at buffer to the sector specified by `sect_num`. No verify is performed.

> `

>         unsigned char __fastcall__ dio_write_verify (dhandle_t handle,
>                                                      sectnum_t sect_num,
>                                                      const void *buffer);

> `

This function will write the memory contents at buffer to the sector specified by `sect_num`. A verification is performed.

Use the `dio_query_sectsize` function to query the size of a sector and the `dio_query_sectcount` function to query the number of available sectors.

All these functions will return 0 for success and an OS specific error code in case of failure.

Next Previous Contents