[Gllug] Pointer arithmetic with void *

Tethys tet at accucard.com
Thu Aug 15 16:31:27 UTC 2002


>I know this is a Linux list and not alt.lang.cpp or similar, but have you 
>considered using C++ and iostreams? Perfect for this sort of thing.
>
> [...]
>
>  // then you can grab whitespaced tokens like this:
>  string token;
>  ss >> token;
>  
>  // or get individual chars like this:
>  char c;
>  ss.get(c)
>
>  // or indeed whole chunks:
>  char chunk[size];
>  ss.get(chunk, size);

...and for grabbing a variable length integer where the length is
determined by magic bits in the first and subsequent bytes read?
AFAICS, you'll still need to read it in a byte at a time, and do
the magic yourself to get the final integer value. But even if we
ignore the variable length ints for a while, what does the above
give you over just reading the appropriate amount of data directly
from the mmap()ed region in C (either via a direct cast to a suitable
data type, or via a memcpy)?

Tet

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list