Re: Comparing memory with a constant
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 23 Nov 2006 03:41:06 -0500
Ian Collins wrote:
CBFalconer wrote:.... snip ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How about the following (using strings for convenience), untested:
What if a pattern contains a 0 byte?
#include <strings.h>
void switchonpattern(const char *pattern)
{
static const char *patterns[] = {NULL
,"pattern1"
,"pattern2"
....
,"patternN");
Note the underlined above. If you want arrays, use arrays and
memcmp. You may then need a length parameter in addition, or a
record with a length field.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- References:
- Comparing memory with a constant
- From: galapogos
- Re: Comparing memory with a constant
- From: galapogos
- Re: Comparing memory with a constant
- From: Ian Collins
- Re: Comparing memory with a constant
- From: galapogos
- Re: Comparing memory with a constant
- From: Chris Torek
- Re: Comparing memory with a constant
- From: galapogos
- Re: Comparing memory with a constant
- From: J. J. Farrell
- Re: Comparing memory with a constant
- From: CBFalconer
- Re: Comparing memory with a constant
- From: Ian Collins
- Comparing memory with a constant
- Prev by Date: Installing gcc problem
- Next by Date: Re: What should I use :LINUX or WINDOWS
- Previous by thread: Re: Comparing memory with a constant
- Next by thread: Re: Comparing memory with a constant
- Index(es):
Relevant Pages
|