Hello.
Recently started to learn some basic programming.
Problem: There is a file, which we will call ultra.dat.
This numbers.dat have lots of numbers and combinations with arrays of [151][201]. I have so far written a code that will read the text file and print them on the screen. This have worked so far and it prints all the numbers exactly in the numbers.dat. Now, the next step for it is to re-arrange the combinations and put them in arrays of [151][201] and save the file named ultra1.dat.
Problem here is that it doesnt put them in arrays. I have tried so many ways but it simply just don't work. How do I accomplish it?
thanks!
Code:
#include <stdio.h>
int main (void){
FILE *ultra;
FILE *ultraskriv;
int tal, antal,i,j;
int Matris[151][201];
ultra=fopen("ultra.dat", "r");
for(i=1;i<=(151);i++)
for(j=1;j<=(201);j++){
fscanf(ultra, "%d", &antal);
printf("%5d", antal);
}
ultraskriv=fopen("ultra1.dat","w");
for(i=1;i<=(151);i++){
for(j=1;j<=(201);j++)
fprintf(ultraskriv,"%d", &Matris[i][j]);
fclose(ultraskriv);
}
fclose(ultra);
}