I'm wrote function which count time of multiplying matrix. That is code:
if ((file = fopen("../logs.txt","w")) != NULL)
{
for(int i = 0; i < 5; ++i)
{
if(QueryPerformanceCounter(&start) !=0)
{
mult(m1, m2, m3);
QueryPerformanceCounter(&finish);
double temp = (double)(finish.QuadPart - start.QuadPart)/frequency.QuadPart;
if(temp<=min || min == 0)
min = temp;
}
}
fwrite(&min, sizeof(min), 1, file);
fclose(file);
}
When i debug it, I saw that my min time equal 0.26336317888614069, but in file it was written "2W<сЪР?". Tell me please what is wrong.
You are writing the binary representation to the file, rather than the human-readable one.
Use:
fprintf(file, "%f", min);