CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 1999
    Posts
    9

    Howto use basic_string ??

    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


  2. #2
    Join Date
    May 1999
    Location
    France
    Posts
    61

    Re: Howto use basic_string ??

    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.


  3. #3
    Join Date
    May 1999
    Location
    WA
    Posts
    236

    Re: Howto use basic_string ??

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured