Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120280115
gdiff
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 3, 05:39
Size
1 KB
Mime Type
text/x-python
Expires
Sat, Jul 5, 05:39 (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
27166058
Attached To
rGTOOLS Gtools
gdiff
View Options
#!/usr/bin/python
import sys, os
from numpy import *
file1 = sys.argv[1]
file2 = sys.argv[2]
isize1 = os.path.getsize(file1)
isize2 = os.path.getsize(file2)
if isize1 != isize2:
print "files do not have the same size"
sys.exit()
f1 = open(file1)
f2 = open(file2)
block = 0
while 1:
block = block + 1
print "block = %d"%(block)
# header
n1 = fromstring(f1.read(4),int32)[0]
n2 = fromstring(f2.read(4),int32)[0]
if n1!=n2:
print "block %d, n1=%d n2=%d"%(block,n1,n2)
sys.exit()
print " reading n=%d octets"%(n1)
# block
l1 = f1.read(n1)
l2 = f2.read(n2)
if l1!=l2:
print " block %d, l1=! l2"%(block)
for i in range(len(l1)):
print i,l1[i]==l2[i],">%s< >%s<"%(l1[i],l2[i])
#sys.exit()
# header
n1 = fromstring(f1.read(4),int32)[0]
n2 = fromstring(f2.read(4),int32)[0]
fsize1 = f1.tell()
fsize2 = f2.tell()
if fsize1 != fsize2:
print " error : fsize1=%d fsize2=%d"%(fsize1,fsize2)
if (fsize1 == isize1) or (fsize2 == isize2):
print "end of file"
sys.exit()
Event Timeline
Log In to Comment