i write a program which write a value of a pointer into file using "out" now i need to read this data from the file but when i read it and print it on the screen a minus value appear.
can you help me by tell9ing me how to read data using "in" and why yhis problem occur
Why are you using this form: (a + i*arraysize +j) rather than subscript notation a[i][j]?
It's simpler, for one, and it is also easier to see that (a + i*arraysize +j) means the same as &a[i][j].
Or that *(a + i*arraysize +j) means the same as a[i][j].
So what you are putting into your file are not the values you have created, but their location -- which is fairly meaningless.
It might be helpful to output some text into the file to denote matrices, and perhaps make them look like 2D matrices rather than one long column.
Also, MSVC6 uses incorrect scoping rules with variables declared in a for loop. I'd say just move your i, j, q outside of the loops.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.