[prev in list] [next in list] [prev in thread] [next in thread] 

List:       curl-library
Subject:    Re: Need to maintain statistics on a page as it is downloading and in real time
From:       martine () cs ! washington ! edu (Evan Martin)
Date:       2001-12-17 10:51:17
[Download RAW message or body]

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@cs.washington.edu
  http://neugierig.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic