2 atlc - arbitrary transmission line calculator, for the analysis of
3 transmission lines are directional couplers.
5 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either package_version 2
10 of the License, or (at your option) any later package_version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 Dr. David Kirkby, e-mail drkirkby at ntlworld.com
35 int main (int argc, char **argv)
38 unsigned char *mem1, *mem2;
39 long length1, length2, i;
43 fprintf(stderr,"Usage file1 file2 - finds the difference between them\n");
46 if( (fp1=fopen(argv[1],"rb")) == NULL)
48 fprintf(stderr,"Unable to open %s\n", argv[1]);
51 if( (fp2=fopen(argv[2],"rb")) == NULL)
53 fprintf(stderr,"Unable to open %s\n", argv[2]);
56 if( fseek(fp1,0,SEEK_END) == -1)
58 fprintf(stderr,"fseek failure on fp1 in locatediff.c\n");
61 if( fseek(fp2,0,SEEK_END) == -1)
63 fprintf(stderr,"fseek failure on fp2 in locatediff.c\n");
66 if ((length1=ftell(fp1)) == -1)
68 fprintf(stderr,"Unable to determine file pointer position with ftelll on fp1\n");
71 if ((length2=ftell(fp2)) == -1)
73 fprintf(stderr,"Unable to determine file pointer position with ftelll on fp2\n");
76 if(length1 != length2)
78 fprintf(stderr,"file1 and file2 are not of the same length\n");
81 mem1=(unsigned char *) malloc((size_t)length1);
84 fprintf(stderr,"Failed to allocate memory in locatediff #mem1\n");
87 mem2=(unsigned char *) malloc((size_t)length2);
90 fprintf(stderr,"Failed to allocate memory in locatediff #mem2\n");
93 fseek(fp1,0,SEEK_SET);
94 fseek(fp2,0,SEEK_SET);
95 fread((void *) mem1,1,(size_t)length1, fp1);
96 fread((void *) mem2,1,(size_t)length2, fp2);
97 for(i=0; i<length1; ++i)
99 if(mem1[i] != mem2[i])
100 printf("At offset= %ld file1 = %d file2 = %d difference=%d\n",i,(int) mem1[i],(int) mem2[i],(int) (mem1[i]-mem2[i]));