Posted by: |<1$|-| July 14, 2007
c++ question to programmers ----
Login in to Rate this Post:     0       ?        
From the error message and your code fragment it seems that var is declared as a 2 dimensional array (look at the error message, it says cannot convert 'double' instead of 'double *' => var[k][t] is double instead of double *). The first argument to fwrite() has to be a pointer. You can use type casting but make sure that the pointer points to contiguous block of memory (might not be contiguous if you dynamically allocate 2 or higher dimensional arrays). The third argument to fwrite() in your code fragment seems to have some problems. Although it is correct syntactically, it might have some semantic issues. sizeof(var[k][t]) is sizeof(double) if var is 2D or sizeof(double *) if var is 3D. The point is that it will always be constant (unless this is what you want).
Read Full Discussion Thread for this article