The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
genarray.c
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * genarray.c -
4  *
5  * $Id: genarray.c 2837 2013-06-29 08:36:36Z chrislit $
6  *
7  * Copyright 1996-2013 CrossWire Bible Society (http://www.crosswire.org)
8  * CrossWire Bible Society
9  * P. O. Box 2528
10  * Tempe, AZ 85280-2528
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation version 2.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  */
22 
23 #include <stdio.h>
24 #include <fcntl.h>
25 #include <stdlib.h>
26 
28 {
29  int fd, l1, l2, l3;
30  char *fnames[] = {"ot.bks", "ot.cps", "nt.bks", "nt.cps"};
31  long val;
32  char buf[64];
33 
34 #ifndef O_BINARY // O_BINARY is needed in Borland C++ 4.53
35 #define O_BINARY 0 // If it hasn't been defined than we probably
36 #endif // don't need it.
37 
38 
39  for (l1 = 0; l1 < 2; l1++) {
40  for (l2 = 0; l2 < 2; l2++) {
41  l3 = 1;
42  sprintf(buf, "%s", fnames[(l1*2)+l2]);
43  printf(" // %s\n", fnames[(l1*2)+l2]);
44  fd = open(buf, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
45  while (read(fd, &val, 4) == 4) {
46  l3++;
47  printf("%ld, ", val/(4 + (l2*2)));
48  if (!(l3%7))
49  printf("\n");
50  }
51  close(fd);
52  printf("}, \n");
53  }
54  }
55 }
#define S_IRGRP
Definition: filemgr.cpp:52
#define S_IREAD
Definition: filemgr.cpp:70
int main(int argc, char **argv)
Definition: addcomment.cpp:32
#define S_IROTH
Definition: filemgr.cpp:56
#define S_IWRITE
Definition: filemgr.cpp:73
#define O_BINARY