#include #include #include #include #include typedef struct All{ float mass,x,y,z,vx,vy,vz; float spin,sigv,q,s; /* spin is the halo spin. Some halos can have negative values */ /* sigv is the halo velocity dispersion */ /* and q,s is the radius ratio of intermediat and minor to major */ float angmom[3],v[3][3]; /* angmom[3] is the angular momentum vector of the halo */ /* v[3][0] directional cosine of the major, */ /* v[3][1] directional cosine of the intermediate, and */ /* v[3][2] directional cosine of the minor axis */ } All; All *array; int main(int argc, char **argv){ int np; FILE *fp; fp = fopen(argv[1],"r"); fread(&np,sizeof(int),1,fp); array = (All *)malloc(sizeof(All)*np); fread(array,sizeof(All),np,fp); fclose(fp); }