fseek error

Hi,

I am using fseek to expand a file..

suppose the current file size is 100bytes..

now i seek to 100 bytes.. and write 10 bytes of information that i want..

it is giving me a seek error. (the api description say.. one can seek outside the file's length as well)

1
2
3
4
5
6
//seek the page position
if(fseek(heapfile, (tempFreePageNum * PAGE_SIZE_IN_BYTES), SEEK_SET) != 0){
	err = SEEK_ERROR;
	goto ret;
}


how do i fix this ? (please do let me know if i have to furnish any details)

(pardon me using goto :) )

Thanks.
please terrordrone can you explain more what you need to do in order we can help you ?
I am getting a seek error at that part.. i do not understand why i am getting a seek error.. it sometimes works and sometimes doesnt...

heapfile is a file pointer.. opened in r+ mode
do you include stdio.h ?
I am getting a run time error.
you got seek error this mean that the condition of "if" is satisfied
so now look what satisfy this condition
Last edited on
i thin you may use seek_end and not seek_set
will modify the logic to use seek_end and will post what happens...
Topic archived. No new replies allowed.