This is a part of a code i wrote, i BOLD-marked the problem, an anyone fine it? index = ((id%MAX_BORROW_SIZE)*(sizeof( brw_movie))); fseek(fp_borrowed, index, SEEK_SET); fread(&temp, sizeof(brw_movie), 1, fp_borrowed); if (temp.ordered == 1) { temp.ordered = 0; fseek(fp_borrowed, index, SEEK_SET); //temp.catalog_id = 0; fwrite(&temp, sizeof(brw_movie), 1, fp_borrowed); printf("Movie id# %d has been deleted from Borrowed Movies.\n", id); // **************** CHECK *************** // fseek(fp_borrowed, index, SEEK_SET); fread(&temp, sizeof(brw_movie), 1, fp_borrowed); printf(" --> %d\n", temp.ordered); OUTPUT --> What is the movie catalog no#? 22 Your fine is: 75.000000 due to lag of 15 days! Movie id# 22 has been deleted from Borrowed Movies. --> 1 The movie was already ordered by another customer (# 2).
Its ok, thanks... the problem was i opened the file as "r" and couldn't write there... Thanks anyways... -Tal