> fprintf (stdout, "%d ", list[i][j]);
Maybe printf to fp instead?
> fprintf (stdout, "%d ", list[i][j]);
Maybe printf to fp instead?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Your actually sending the data to stdout,and not the file itself!Don't you see them at your screen?
I see the data on screen, but I would like to see them in the file as well.
So you should do what salem said!fprintf send the data to the stream you told her to.So if you use stdout,the data will be printed on screen.If you use fp,then the data will be sent to where fp points(fp points to your file!)
So i you want to see them both in file and in screen ,use fprintf twice.Ok?