Originally Posted by
chico1st
the reason that I think i need this giant array is that i have a special card in my computer which takes 250Million measurements and puts them into an array. (im not using all the measurements.)
that part is automated.
I need to take that array and Transpose it:
x,x,x,x goes to
x,x,x,x
x,x
x,x
x,x
x,x
Then read it into a binary file, i might be able to avoid this giant array if reading 1 large array into a binary file is the same as reading a couple smaller ones. I dont know if the output is the same though... nor do i know how to check because i cant read it
*thats the basics.. my program isnt that lame*
Reading an array from a binary file is just like reading one variable of the array's type over and over again. This
Code:
int array[10];
fread(array, sizeof(*array), sizeof(array)/sizeof(*array), fp);
/* or, more readably but less good-practicability */
fread(array, sizeof(int), 10, fp);
is the same as
Code:
int array[10];
fread(array, sizeof(int), 5, fp);
fread(&array[5], sizeof(int), 5, fp);
which is the same as
Code:
int array[10], x;
for(x = 0; x < 10; x ++) {
fread(&array[x], sizeof(int), 1, fp);
}
See this reference for fread(). http://www.cplusplus.com/reference/c...dio/fread.html
But if all you're doing is . . . well, transposing some numbers, then you don't even need to store the data in an array. Just read a couple of integers and repeat until EOF.