1. Use [code][/code] tags, so
void klanten(int *klantennr)
{
KLANT_GEGEVENS klant;
looks more like this
Code:
void klanten(int *klantennr)
{
KLANT_GEGEVENS klant;
2. klanten_file=fopen("klanten.bin","wb");
Perhaps "ab" if you want to append to what's already there.
But you already seek to the end - so what's the question?
3. fflush(stdin);
Flushing input streams is undefined. Whatever it might do for you, I can tell you it doesn't work for me. If you're being good and using fgets() for everything (and not mixing it with scanf), then there should be no need for even trying to "flush the input stream"
4. fgets(klant.voornaam, 20, stdin);
I hope these structures contain real arrays, and not just char * pointers.
Though you should really do
Code:
char buff[BUFSIZ];
fgets( buff, sizeof buff, stdin ); // and check for errors
// validate the buff in some way
strcpy( klant.voornaam, buff );
5. scanf("%d", &klant.adres.postcode);
Yeah, mixing fgets and scanf - bad voodoo there.
Use fgets() + sscanf() if you need to do this.
Also, how long are your postcodes, do they have significant leading zeros? Like phone numbers, it's probably not good to store them as ints.