# FatFs - disk_write

## disk_write

The disk_write writes sector(s) to the disk.

    DRESULT disk_write (
      BYTE Drive,          /* Physical drive number */
      const BYTE* Buffer,  /* Pointer to the write data (may be non aligned) */
      DWORD SectorNumber,  /* Sector number to write */
      BYTE SectorCount     /* Number of sectors to write */
    );

#### Parameters

Drive
  Specifies the physical drive number.
Buffer
  Pointer to the byte array to be written. The start address specified by upper layer may be aligned or non-aligned.
SectorNumber
  Specifies the start sector number in logical block address (LBA).
SectorCount
  Specifies the number of sectors to write. The value can be 1 to 255.

#### 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.

Return