Problems with fseek, not notifying past end of file
I'm using 'fseek' and when I try to set the pointer beyond the end of file, I don't get and error message. Does anybody know how to generate an error message from from 'fseek' to monitor when you have gone beyond the end of file.
Here is my code:
struct Person DB;
void rfile_db(void) // READ A RECORD TO DB
if ((fptr = fopen("temp3.rec", "r+b")) ==NULL)
AfxMessageBox("Can't Open/Create File ");
// recno is the max # of records in the file
offset = recno * sizeof(DB); // DB is a struct of the file
I'm not sure, but may be it is for creating files like 'something-"empty"_space-something'. I mean that you can write 24 bytes from the beginning of file, then set pointer to 1024 bytes and write 40 more bytes without writing 1000 intermediate bytes.
May be these bytes will be zeroes, may be not. You can make a test program, I am too lazy.