Re: strchr function fails to work properly on Windows 2003 Server

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 09/17/04


Date: Fri, 17 Sep 2004 12:03:03 -0400


"Jaime Rios" <JaimeRios@discussions.microsoft.com> wrote in message
news:C94E08D7-C169-4528-8A1E-DF3B6FFDC0BC@microsoft.com
>>> char* cp = strchr(string, (int)cpChar);
>>
> No, not Unicode... char* cpChar... and I would like to see if cpChar
> == NULL. Thanks.

Huh? The second parameter of strchr is supposed to be a character, _not_
a pointer. What do you expect this code to do? If you want to know
whether cpChar is NULL, why not

if (cpChar == NULL) {...}

-- 
With best wishes,
    Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage


Relevant Pages

  • Re: possible undefined use of strchr
    ... strchr returns a null pointer if the character is not found in ... Since it considers '\0' to be part of the string, ... since you must pass a string to strchr, a search for '\0' will always ... return a pointer to the null terminator. ...
    (comp.lang.c)
  • Request for comments - kgets()
    ... macro and a function-like macro macros below) ... pointers, dereferencing pointers, pointer arithmetic, and how (at ... character by character I can discuss a conceptual model of the ... FIFO Model - A block of memory having two pointers. ...
    (comp.lang.c)
  • Re: "index" efficiency... any help or ideas?
    ... > That's still a lot of checking; with a good hash, ... byte number of possibilities for character ... absolute jump address to the handler for that command... ... then the pointer is an offset relative to ...
    (alt.lang.asm)
  • [PATCH] Fix for bug W343-3, part 4: Description of the patch
    ... Bug W343-3 really consists of two distinct and unrelated bugs. ... the second parameter is ignored. ... character sets for the normal dungeon. ... * Add the needed second parameter to switch_graphics. ...
    (rec.games.roguelike.nethack)
  • Re: Additional resources to understand C better.
    ... but a char* or void* pointer has a 3-bit offset ... This is implemented entirely in code generated by the compiler, ... If you want to have 8-bit character types on a computer that can't ...
    (comp.lang.c)