Re: Calculate length of byte string with embedded nulls
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Thu, 04 Jan 2007 19:21:28 GMT
Angus wrote:
Hello
I have a stream of bytes - unsigned char*.
If it's a text stream,
then I suspect that you may be wanting to calculate
the length of the "line" rather than the length of a string.
Lines of text are terminated by a newline character ('\n').
The way to find the length of the line is to do it
while the line is being read.
But the 'string' may contain embedded nulls.
So not like a traditional c string terminated with a null.
I need to calculate the length of these arrays
but can't use strlen because
it just stops counting at the first null it finds. so how to do it?
--
pete
.
- References:
- Prev by Date: Re: Calculate length of byte string with embedded nulls
- Next by Date: Re: Calculate length of byte string with embedded nulls
- Previous by thread: Re: Calculate length of byte string with embedded nulls
- Next by thread: Re: Calculate length of byte string with embedded nulls
- Index(es):
Relevant Pages
|
|