I am trying to output my result as binary. This is what I am doing:
outfile1 = fopen("data1.bin", "ab");
while (flag == 0)
{
r1 = r1 + 0.01;
fwrite(&r1, sizeof(double), 1, outfile1);
.....
.....
}
The above code is just a sample code. The problem that I am having is that how long my code runs the size of the output file is 172 KB. I think my code stops writing to the file once the file size in 172 KB. I think my problem is that I do not understand fwrite's syntax. Since I am writing a simulation, I don't know how long it's going to run. Thus, I don't know the number of elements my file should have. So, I have used "1" in fwrite.
Aucun commentaire:
Enregistrer un commentaire