Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: strlen

Author: Tom Likens

Date: 07:23:47 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.

The only caveat to this, is be careful if you are using this
in any loop intensive code that needs to be fast.  A number
of the C++ implementations of the string class are dog slow.

If you're using this for interface code that doesn't need to
be all that fast then I think using a string is definitely
the way to go.  Otherwise, you may want to time things using
a good profiler, and make your decision based on the results.

Oh, and to answer your original question use <cstring>.

regards,
--tom



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.