curl-library
Re: Need to maintain statistics on a page as it is downloading and in real time
Date: Mon, 17 Dec 2001 02:51:17 -0800
On Sat, Dec 15, 2001 at 11:32:46PM -0800, Mike and Melissa Malloy wrote:
> Search for string "hello"
> request n data: xxxxxxxxxxxxxxxx....xxhel
> request n+1 data: loxxxxxxxxxxxxxx....xxxxx
>
> My plan is to concatenate data blocks into a buffer until the string is
> found and then perform a memmove of the buffer, starting with character
> after the string is found to the beginning of the buffer. If anyone knows
> of a better approach or why this approach wouldn't work, I would very much
> like to know.
Here's a utility that's designed for this sort of problem:
http://phil.ipal.org/freeware/vrb/
Basically, it lets you use an array like a FIFO, but without the
end-of-buffer problem. Even if you don't use it, it's a neat hack
that's worth appreciating just for that. :)
It's probably overkill for what you're working on. Your memmove
solution should be sufficient.
-- Evan Martin martine_at_cs.washington.edu http://neugierig.orgReceived on 2001-12-17