I'm been omitting the report() function because there has been no fault in it. Yea, "deleted" records are not displayed via if (prodtype != 0) in the report. What I displayed above was an undeleted...
Type: Posts; User: mammoth
I'm been omitting the report() function because there has been no fault in it. Yea, "deleted" records are not displayed via if (prodtype != 0) in the report. What I displayed above was an undeleted...
I like the random access idea, but for some reason when I fwrite to the record, it stores all sorts of weirdness as well as the value zero to mark it as "deleted."
Here's what I tried instead of...
So, winning combination:
fopen using r+b
fseek(bf,0-sizeof(recs),SEEK_CUR)
fflush(bf)
Thanks everyone for the help! Here's the finished function for forum completeness:
void...
Ha! w+b is bad if I want to keep my binary file data. There's an aptly placed TNT detonator icon in my text for that mode. It truncated my file nice and clean! =)
...
Quzah: Thanks, I overlooked void and my fopen mode in this function. As far as checking for a return value, do you mean this?:
if (bf == NULL)
{
printf("Cannot open file in report:...
Goal:
Read and display sets of data in a binary file in struct format. Prompt for the set to be "deleted" (that is, change a value to zero). Then write that value back to the binary file.
...
Flippin' sweet! For some reason I read fscanf as only returning a count of values, rather than assigning them as well. In this instance, I had 10 values in a "min max" syntax on 5 lines in the text...
Hello, I have been struggling with this idea for a while and cannot seem to master it.
I need to open a text file, obtain space separated values, then refer to them in later functions. The idea...