Here's my problem.
I'm trying to write info to a bin file, consider the following piece of code:
FILE *fp = fopen("banco\\banco.bin", "ab");
char buffer[22];
sprintf(buffer, "55555555 111111 11111");
fwrite(buffer, sizeof(char), 22, fp);
fclose(fp);
when I run this it writes to the file that line twice
when I print it I get
55555555 111111 11111
55555555 111111 11111
and if I run it again adding a line like
44444444 111111 11111
it will output
55555555 111111 11111
44444444 111111 11111
44444444 111111 11111
Why is it happening any idea ?