First I have this:
int main (void)
{
int m = 10;
double x[3] = {1.5, -3.5, 3.25};
int n1, n2; FILE *izTok;
izTok = fopen ("podaci.bin", "wb");
n1 = fwrite (&m, sizeof(m), 1, izTok);
n2 = fwrite (x, sizeof(x[0]), 3, izTok);
fclose(izTok);
return 0;
}
And after that I try to read from it with
FILE *stream;
stream = fopen("podaci.bin", "r");
n1 = fread(&n, sizeof(n), 1, stream);
n2 = fread(arr, sizeof(arr[0]), 3, stream);
printf("%d %f %f %f", n, arr[0], arr[1], arr[2]);
And regardless of whether I put
stream = fopen("podaci.bin", "r");
or
stream = fopen("podaci.bin", "rb");
the output is the same
10 1.500000 -3.500000 3.250000
Whats the point of the flags if it does the same thing both times?