Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: strlen

Author: Odd Gunnar Malin

Date: 01:50:59 01/24/03

Go up one level in this thread


On January 24, 2003 at 03:22:37, Steffen Jakob wrote:

>On January 24, 2003 at 03:15:55, Joshua Haglund wrote:
>
>>What do I need to #include to use strlen?
>>I've tried almost everything I can think of!
>>(C++)
>
>Don't use strlen() in C++ but std::string and its member function length(). :-)
>
>Greetings,
>Steffen.

Sometimes you have to use routines from c's string.h, then to not confuse
yourself to much and also take care of std namespace, <cstring> should be used
instead of <string.h>.
The same goes for other (<ctime>, <cstdlib> etc...).

A sample I use a lot is the following in the top of files.

#ifdef _DEBUG
  #define _CRTDBG_MAP_ALLOC
  #include <cstdlib>
  #include <crtdbg.h>
#endif

Another could be if you want a case insensitive compare, then it's easier to use
cstring's stricmp instead of writing your own in c++.

Odd Gunnar



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.