pic32/libraries/SD/utility/SdFile.cpp
//------------------------------------------------------------------------------
/**
 * The sync() call causes all modified data and directory fields
 * to be written to the storage device.
 *
 * \return The value one, true, is returned for success and
 * the value zero, false, is returned for failure.
 * Reasons for failure include a call to sync() before a file has been
 * opened or an I/O error.
 */
The sync() call causes all modified data and directory fields
to be written to the storage device.

\return The value one, true, is returned for success and
the value zero, false, is returned for failure.
Reasons for failure include a call to sync() before a file has been
opened or an I/O error.
The sync () call causes all modified data and directory fields to be written to the storage device . \ return The value one true is returned for success and the value zero false is returned for failure . Reasons for failure include a call to sync () before a file has been opened or an I / O error .
uint8_t SdFile::sync(void) {
  if (!isOpen()) return false;
  if (flags_ & F_FILE_DIR_DIRTY) {
    dir_t* d = cacheDirEntry(SdVolume::CACHE_FOR_WRITE);
    if (!d) return false;
    if (!isDir()) d->fileSize = fileSize_;
    d->firstClusterLow = firstCluster_ & 0XFFFF;
    d->firstClusterHigh = firstCluster_ >> 16;
    if (dateTime_) {
      dateTime_(&d->lastWriteDate, &d->lastWriteTime);
      d->lastAccessDate = d->lastWriteDate;
    }
    flags_ &= ~F_FILE_DIR_DIRTY;
  }
  return SdVolume::cacheFlush();
}
uint8_t SdFile :: sync ( void ) { if ( ! isOpen ( ) ) return false ; if ( flags_ & F_FILE_DIR_DIRTY ) { dir_t * d = cacheDirEntry ( SdVolume :: CACHE_FOR_WRITE ) ; if ( ! d ) return false ; if ( ! isDir ( ) ) d -> fileSize = fileSize_ ; d -> firstClusterLow = firstCluster_ & 0 XFFFF ; d -> firstClusterHigh = firstCluster_ >> 16 ; if ( dateTime_ ) { dateTime_ ( & d -> lastWriteDate , & d -> lastWriteTime ) ; d -> lastAccessDate = d -> lastWriteDate ; } flags_ &= ~ F_FILE_DIR_DIRTY ; } return SdVolume :: cacheFlush ( ) ; }
The sync() call causes all modified data and directory fields
 to be written to the storage device.
The sync () call causes all modified data and directory fields to be written to the storage device .
// only allow open files and directories // do not set filesize for dir files // update first cluster fields // set modify time if user supplied a callback date/time function // clear directory dirty