Yep... you didn't clear the struct before creating the data...
Originally Posted by mammoth
When adding a new record you should always use mset(&struct,0,sizeof(struct)); before adding data to it.
Also the seek and write functions should be inside your conditional to prevent it from writing garbage if the operator enters an invalid record number.
recs.prodtype = 0;
fseek(bf, spot, SEEK_SET);
fwrite(&recs, sizeof(recs), 1, bf);
When editing (eg. changing pricess and such...) you will still get some interspersed garbage if you shorten a string, but numbers are fixed size and should stay clean... for example if you replace "Taco Bell Tacos" with "Hot Dogs"... the record in raw view will show... "Hot Dogs l Tacos" ... this is of no consequence as long as your strings are properly null terminated.
Plus... if a record is deleted, you should not display it at all... maybe just the searched number and "<-deleted->" at most