Debian Codegraph @

biosig4c++/test0/gztest.c

raw symbols SCIP
1 /*
2
3 $Id: gztest.c,v 1.2 2007-08-31 13:18:15 schloegl Exp $
4 Copyright (C) 2007 Alois Schloegl <[email protected]>
5 This function is part of the "BioSig for C/C++" repository
6 (biosig4c++) at http://biosig.sf.net/
7
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23 */
24
25
26 #include "../biosig.h"
27 #include <string.h>
28
29 int main(int argc, char **argv){
30
31
32 HDRTYPE HDR, *hdr;
33 CHANNEL_TYPE* cp;
34 size_t count;
35 uint16_t numopt = 0, k;
36 time_t T0;
37 char *source, *dest;
38 enum FileFormat TARGET_TYPE=GDF; // type of file format
39 int COMPRESSION_LEVEL=0;
40 uint8_t mem[100000];
41 char tmp[100], p[10];
42
43 source=argv[1];
44
45 hdr = &HDR;
46 hdr->TYPE = unknown;
47 hdr->FILE.COMPRESSION = 0;
48 hdr->FileName = source;
49 hdr = FOPEN(hdr,"rb");
50 count = FREAD(mem,1,100000,hdr);
51 hdr->AS.Header1 = mem;
52 hdr = getfiletype(hdr);
53 FCLOSE(hdr);
54 fprintf(stdout,"1: %s %i %i %i %i %i %i %i %i \n",hdr->FileName, count,hdr->TYPE,unknown,GDF,GZIP,SCP_ECG,HL7aECG,BDF);
55
56 hdr->FILE.COMPRESSION = 0;
57 hdr->FileName = source;
58 hdr = FOPEN(hdr,"rb");
59 count = FREAD(mem,1,100000,hdr);
60 hdr->AS.Header1 = mem;
61 hdr = getfiletype(hdr);
62 FCLOSE(hdr);
63 fprintf(stdout,"2: %s %i %i %i %i %i %i %i %i \n",hdr->FileName, count,hdr->TYPE,unknown,GDF,GZIP,SCP_ECG,HL7aECG,BDF);
64 /*
65 hdr->FILE.COMPRESSION = 0;
66 hdr->FileName = "out0.fil";
67 hdr = FOPEN(hdr,"wb");
68 count = FWRITE(mem,1,count,hdr);
69 FCLOSE(hdr);
70
71 hdr->FILE.COMPRESSION = 0;
72 hdr->FileName = "out00.fil";
73 hdr = FOPEN(hdr,"wb");
74 count = FWRITE(mem,1,count,hdr);
75 FCLOSE(hdr);
76
77 for (k=0;k<10;k++) {
78 hdr->FILE.COMPRESSION = 1;
79 strcpy(tmp,"out10.fil");
80 *(tmp+4)=k+48;
81 strncpy(p,"wb",5);
82 p[strlen(p)]=k+48;
83 hdr->FileName = tmp;
84 hdr = FOPEN(hdr,p);
85 count = FWRITE(mem,1,count,hdr);
86 FCLOSE(hdr);
87 }
88 */
89 }