
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] binary search of binary data
- Date: Mon, 27 Dec 2004 21:34:03 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] binary search of binary data
- References: <20041225205936.GA2199@example.com>
- Organization: The XEmacs Project
- User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, linux)
>>>>> "Edward" == Edward Wright <edw@example.com> writes:
Edward> Feels like there should be a simple answer to this, but it
Edward> eludes me.
It depends on what you want to do with the bytes, and how big the file
is. Here's my guess
$ python
>>> infile = open (FILE, "r")
>>> s = infile.readlines()
>>> r = compile ("\xec\xa5\xc1\x01")
>>> m = r.search (s, 0)
>>> while m:
>>> print "match at %d\n" % m.start()
>>> m = r.search (s, m.end())
>>>
>>> ^D
$
Edward> which works sometimes - depending on the hex values, I
Edward> suppose.
Don't guess at why. Tell us exactly how it fails, preferably by
capturing a session and attaching it.
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
Home |
Main Index |
Thread Index