#include "largefiles.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ MAP_FILE
◆ READINT
Value:{
X=0;
if (isbig) {
for(j=0;j<4;++j,
X<<8)
X+=d[j]; } \
else {
for(j=3;j>=0;--j,
X<<8)
X+=d[j]; } }
◆ SKIP
#define SKIP |
( |
|
X | ) |
{d+=(X);n-=(X);} |
◆ SKIPFOUR
#define SKIPFOUR {d+=4;n-=4;} |
◆ int32
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 27 of file dumpdcd.c.
References MAP_FILE, and SKIPFOUR.
31 int i, j, isbig, itmp;
41 fprintf(stderr,
"This program reads the ICNTRL array from DCD files.\n");
42 fprintf(stderr,
"Usage: %s <filename> > <data>\n",argv[0]);
46 if ( ( fd = open(argv[1], O_RDONLY) ) < 0 ) {
47 fprintf(stderr,
"Can't open %s for reading.\n",argv[1]);
51 if ( fstat(fd,&statbuf) < 0 ) {
52 fprintf(stderr,
"Can't stat %s.\n",argv[1]);
59 fprintf(stderr,
"%s is not in DCD format.\n",argv[1]);
64 fprintf(stderr,
"%s is not in DCD format.\n",argv[1]);
68 if ( ( d = mmap(0,n,PROT_READ,
MAP_FILE|MAP_SHARED,fd,0) )
70 fprintf(stderr,
"Can't mmap %s.\n",argv[1]);
74 #define SKIPFOUR {d+=4;n-=4;} 75 #define SKIP(X) {d+=(X);n-=(X);} 76 #define READINT(X) { X=0; if (isbig) { for(j=0;j<4;++j,X<<8) X+=d[j]; } \ 77 else { for(j=3;j>=0;--j,X<<8) X+=d[j]; } } 82 ccntrl = (
char*)(&(icntrl[0]));
93 printf(
"%f\n",*((
float*)(icntrl+9)));