Re: [CODE] Findind an empty string..

From: George Greer (
Date: 05/20/99

On Thu, 20 May 1999, Phil Durand wrote:


Fails, because it cannot ever be NULL.

>if(GET_TITLE(ch) == "")

Fails, because the title can never be the same location as the new string
on the other side of the == sign.

>if(GET_TITLE(ch) == '\0')

This is equivalent to testing for NULL. ('\0' = 0 = NULL) [1]

>if(GET_TITLE(ch) == NULL)


>I mean, some of those are useless of course, and I've even tried str_cmp and
>it still doesn't figure out that the string is actually empty...

if (*GET_TITLE(ch) == '\0')

George Greer            | The Ceramic Mouse & Snippets   |

[1] Give or take a (void *) cast on NULL depending on your headers.
    Also different in C++ which really discourages void pointers.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST