title: Casting an uint8_t* to uint32_t* in c++
body: <p>I am trying to implement an interface function of the FATFS library. The implementation expects an uint8_t* to the data that has to be written to an internal SD card by a different library. The data should be written to the library using the function BSP_SD_WriteBlocks(uint32_t*, uint64_t, uint32_t, uint32_t). (See Below)</p>
  
  <pre><code>/*
   * Write data from a specific sector
   */
  int SDMMC::disk_write(const uint8_t *buffer, uint32_t sector, uint32_t count)
  {
      int res = BSP_SD_WriteBlocks((uint32_t*)buffer, (uint64_t)sector, 512, count);
  
      if (res == MSD_OK) {
          return RES_OK;
      } else {
          return RES_ERROR;
      }
  }
  </code></pre>
  
  <p>As you can see I am trying to cast an 8-bit memory address to a 32-bit memory address and don't think that this is the correct way to do so.</p>
  
  <p>Unfortunately, I cannot change the function arguments so the disk_write function must accept uint8_t* and the BSP_SD_WriteBlocks merely accepts uint32_t*.</p>
  
  <p>What is the best - and fasted way - to do so? </p>