simplified read/write position reset

This commit is contained in:
Dave Murphy 2008-05-14 13:01:15 +00:00
parent ef3f19697c
commit 25b615836f

View File

@ -594,16 +594,15 @@ int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len) {
return -1; return -1;
} }
file->startCluster = tempNextCluster; file->startCluster = tempNextCluster;
// Appending starts at the begining for a 0 byte file // Appending starts at the begining for a 0 byte file
file->appendPosition.cluster = file->startCluster; file->appendPosition.cluster = file->startCluster;
file->appendPosition.sector = 0; file->appendPosition.sector = 0;
file->appendPosition.byte = 0; file->appendPosition.byte = 0;
if ( file->currentPosition < partition->bytesPerCluster ) { file->rwPosition.cluster = file->startCluster;
file->rwPosition.cluster = file->startCluster; file->rwPosition.sector = 0;
file->rwPosition.sector = (file->currentPosition % partition->bytesPerCluster) / BYTES_PER_READ; file->rwPosition.byte = 0;
file->rwPosition.byte = file->currentPosition % BYTES_PER_READ;
}
} }
if (file->append) { if (file->append) {