954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C file input/output 2D arrays.

Hi there,

I am currently converting a matlab file to C, and need some help writing the data calculated in 2D arrays to files.

This is what i ahve done so far:


File *U;
File *V;
File *X;
File *Y;
U = fopen("U.txt", "w");
V = fopen("V.txt", "w");
X = fopen("X.txt", "w");
Y = fopen("Y.txt", "w");



float U[N][N];

Here i do some calculations to fill the array with the new values.

i am not too sure how to make it write to the file...i have done this so far..

for (int i=0; i

MrCool
Newbie Poster
1 post since Apr 2004
Reputation Points: 10
Solved Threads: 0
 

how bout using fwrite()?

infamous
Junior Poster in Training
77 posts since Mar 2004
Reputation Points: 47
Solved Threads: 2
 

create a stream for file out put and write to that stream like u would with cout

BountyX
Posting Whiz in Training
230 posts since Mar 2004
Reputation Points: 28
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You