Posted by: chanaa_tarkaari July 13, 2007
c++ question to programmers ----
Login in to Rate this Post:     0       ?        
I know there are many programming experts here in Sajha, I am going to put here a simple problem I faced today seeking your suggestions. I am trying to write a numeric array into a binary file using fwrite. The variable is three dimensional converted into two dimensional double type, var[k][t], where [k] contains two-dimension inside. k is not sequential but has to be picked up from i and j released by separate routine. I coded fwrite(var[k][t], sizeof(var[0][t]), sizeof(var[k][t]), FILE*); but it displayed the following error message, error: cannot convert `double' to `const void*' for argument `1' to `size_t fwrite(const void*, size_t, size_t, FILE*)' I have seen fwrite is used successfully in writing character arrays. How can I use this to write numeric array? It seems that I need to add something to successfully convert 'double' to 'const void*', but did not get any clue on that. Any help or suggestions are welcome.
Read Full Discussion Thread for this article