Hi Alex Out of the possible issues I suggested earlier I suspect most strongly you have sizeof(long) != 4.
But Ian is indeed right to promote the canonical answer. Avoid such mess by using the API ;-) -- David On 2 July 2012 15:48, Ian Tickle <ianj...@gmail.com> wrote: > Hi Alex > > Wouldn't you be better off using the API > (http://www.ccp4.ac.uk/dist/html/C_library/cmaplib_8h.html): that way > your program will have a good chance of still working in another 10 > years' time! > > Cheers > > -- Ian > > On 2 July 2012 14:41, Soares, Alexei <soa...@bnl.gov> wrote: > > Hello, Alex here. > > > > Ten years ago, I read CCP4 maps this way, but it no longer works ... can > > anyone tell me why? Note that map1 is an integer so that multiple > headers > > can be read. Also, supposedly the map header is text, but a simple "head > > -1" dumps lots of digital garbage from the map header. > > > > Thanks, and sorry for the beginner question! > > > > // ******************** READ MAP HEADER **************************** > > > > fread( &MAP_H[map1].NC , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NR , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NS , sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].MODE , sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].NCSTART, sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NRSTART, sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NSSTART, sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].NX , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NY , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].NZ , sizeof(long) , 1, read1); > > > > fread( MAP_H[map1].CELL , sizeof(float), 6, read1); > > > > fread( &MAP_H[map1].MAPC , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].MAPR , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].MAPS , sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].AMIN , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].AMAX , sizeof(long) , 1, read1); > > fread( &MAP_H[map1].AMEAN , sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].ISPG , sizeof(long) , 1, read1); > > > > fread( &MAP_H[map1].NSY , sizeof(long) , 1, read1); > > > > fread( MAP_H[map1].REST , sizeof(float), 32, read1); > > > > fread( MAP_H[map1].LAB , sizeof(char) , LAB_LEN, read1); > > fread( MAP_H[map1].SYM , sizeof(char) , MAP_H[map1].NSY, read1); > > >