## disk_write

The disk_write writes sector(s) to the disk.

    DRESULT disk_write (
      BYTE drv,         /* [IN] Physical drive number */
      const BYTE* buff, /* [IN] Write data (may be non aligned) */
      DWORD sector,     /* [IN] Sector number to write */
      UINT count        /* [IN] Number of sectors to write */
    );

#### Parameters

pdrv
  Specifies the physical drive number.
buff
  Pointer to the byte array to be written.
sector
  Specifies the start sector number in logical block address (LBA).
count
  Specifies the number of sectors to write. FatFs specifis 1 to 128. Generally, a multiple sector transfer request must not be split into single sector transactions to the device, or you will never get good write performance.

#### Return Values

RES_OK (0)
  The function succeeded.
RES_ERROR
  Any hard error occured during the write operation and could not recover it.
RES_WRPRT
  The medium is write protected.
RES_PARERR
  Invalid parameter.
RES_NOTRDY
  The disk drive has not been initialized.

#### Description

This function is not required in read only configuration. The specified memory address is not that always aligned to word boundary because the type of pointer is defined as `BYTE`. For more information, read description in disk_read function.

Application program MUST NOT call this function while FatFs is in use, or FAT structure on the volume can be corrapted.

Return