Click to See Complete Forum and Search --> : Howto use basic_string ??


Molle
July 7th, 1999, 04:39 AM
Hiya!

I found a template class called basic_string, but I don't know how to use it.
What headers must I include?

Thanks
Magnus

Chainard Arnaud
July 7th, 1999, 06:49 AM
Hello,

I dont know but it must be the same than CString .

CString String;
CString String2 ( "Hello" );
CString String3 ( String2 );
String = _T( "Hello" );

CString String4;
String4 = String + String2;

...

Arnaud,

A++

Ps : The string is not a got class ( if you don't need to use unicode ), personaly i use char * with strcpy strcmp ... It's faster than CString.

herbieII
July 7th, 1999, 07:32 AM
First include <string> in your program. String class has many constructors and member functions the three most used are:
string();
string(const *str);
string(const &str);
the first creates an empty string object. The second creates a string object from a null-terminated string pointed to by str. The third creates a string from another string. String class supports several operators such as =,+,+= etc.

Roger L. McElfresh