Problem with cdRead()
Posted: Sat Nov 26, 2005 12:47 am
I've encountered a problem with cdRead(). When I try to read a non-existing sector, cdRead() returns 1 (OK) instead of 0 (error).
Example:
And the output is: "Reading data from disc... OK."
I don't know why it acts like that.
Also, does anybody know how to get the total number of sectors on a disc? I guess this information is stored in the TOC, but where?
Example:
Code: Select all
void readtest()
{
int ret;
u8 buf[2048];
CdvdReadMode_t mode;
memset(buf, 0, sizeof(buf));
mode.retries = 10;
mode.sectorType = CDVD_SECTOR_2048;
mode.readSpeed = CDVD_SPIN_NORMAL;
cdInit(0);
printf("Reading data from disc... ");
ret = cdRead(-1, 1, buf, &mode); // read the sector at LBA (-1)
cdSync(0); // blocking
if (!ret) printf("Failed.\n");
else printf("OK.\n");
}
I don't know why it acts like that.
Also, does anybody know how to get the total number of sectors on a disc? I guess this information is stored in the TOC, but where?