Re: Scanning a file

2005-10-28 Thread pinkfloydhomer
Okay, how do I do this? Also, if you look at the code, I build a 32-bit unsigned integer from the bytes I read. And the 32-bit pattern I am looking for can start on _any_ byte boundary in the file. It would be nice if I could somehow just scan for that pattern explicitly, without having to build a

Scanning a file

2005-10-28 Thread pinkfloydhomer
I want to scan a file byte for byte for occurences of the the four byte pattern 0x0100. I've tried with this: # start import sys numChars = 0 startCode = 0 count = 0 inputFile = sys.stdin while True: ch = inputFile.read(1) numChars += 1 if len(ch) < 1: break startCode = ((