PDA

View Full Version : C++ Question: _LSEEK/_READ return no error under XP on unreadable CD


marsoupilami
12th October 2005, 17:53
Hi there!

Maybe this is a C++ newbie question...
I am trying to create a little program that reads whatever is readable of a damaged CD.

Neither a 32 bit console program with a _lseek / _read construct nor the MFC TRY / CATCH will return an error under Win XP - on a W98 machine the 1st example is working.

// 1st example:

if (-1L == _lseek (fi, off, SEEK_SET) {
// SEEK_ERROR
}
else if (SECT != _read (fi, buf, SECT)) {
// READ_ERROR
}
else {
// ok! .....
}

// 2nd Example:

TRY {
if (off != f.Seek (off, SEEK_SET)) {
TRACE("seek_offset"); // NEVER OCCURS
}
}
CATCH( CFileException, e ) {
TRACE ("seek\n"); // NEVER OCCURS
}
END_CATCH

TRY {
if (SECT != f.Read (buf, SECT)) {
TRACE ("read\n"); // NEVER OCCURS
}
}
CATCH( CFileException, e ) {
TRACE ("read\n"); // SOMETIMES HARDWARE DEPENDENT
}
END_CATCH
}

... any ideas are welcome
thanks in advance!