Sponsored Content
Full Discussion: STL map
Top Forums Programming STL map Post 302147106 by cbkihong on Saturday 24th of November 2007 11:09:10 PM
Old 11-25-2007
That is because what the map actually returned is an STL "string" object rather than a char array.

Try to call c_str() on the "basic_string" you received from the map to get the underlying char pointer before you do the strcpy.

basic_string<charT, traits, Alloc>

Or, you can use STL "string" exclusively instead of using char*. C++ programmers usually prefer to use string objects instead of mixing string and char* anyway.
 

7 More Discussions You Might Find Interesting

1. Programming

STL from win

Help me please with STL source code that works on Windows I've found on Inet STL MRU Cache (it compiles fine with Studio 2008), but when trying to build it with Kdevelop (g++ is the compiler) I've got a series of error. One of them I've placed in the source code. If it's important I can post here... (0 Replies)
Discussion started by: Orlando_ua
0 Replies

2. UNIX for Dummies Questions & Answers

c++ stl which rpm?

Hello, I'm using RHEL 5.3, I need to compile C++ code and I'd like to know which rpm contains the STL library. Thanks:) (3 Replies)
Discussion started by: pppswing
3 Replies

3. Programming

stl map - could any one explain the o/p

class tst { public: tst() { cout<<"ctor tst()\n"; } tst(const tst& ob) { cout<<"cp ctor tst()\n"; } ~tst() { cout<<"dtor tst()\n"; } }; map<string,tst> mp; int main(void) { mp; //mp=tst(); } (1 Reply)
Discussion started by: johnbach
1 Replies

4. Programming

which stl is best suited to represent a tree

hi all i have a tree structure: root --- node 1 to node 10 in each node --- sub node 1 to sub node 10 in each sub node --- leaf node 1 to leaf node 10 i have to print this in following fashion: root ---- n1 ---- sn1 ---- l1, l2, l3, ....., l10 n1 ---- sn2 ---- l1, l2, l3,... (2 Replies)
Discussion started by: vidyaj
2 Replies

5. Programming

c++ code to print a tree using stl map

hi all, i need c++ code to print a binary or non binary tree using stl map.... please help me to find the same.......... (1 Reply)
Discussion started by: vidyaj
1 Replies

6. Programming

how to check the value in stl container during debug

Hi, guys. I am working on a project right now. But when I debug my code, I can't see the values in stl container, e.g vector, map. Can anyone help me, please. I am really frustrated:wall:. I am using code::blocks IDE, by the way. Thanks in advance...... (0 Replies)
Discussion started by: tefino
0 Replies

7. Programming

STL transform question

Hi all, I pass to the transform algorithm two vectors, and the suma function. #include <algorithm> #include <iostream> #include <iterator> #include <vector> using namespace std; class Duo{ public: int one; int two; }; Duo suma(Duo first, Duo last){ Duo ret; ... (1 Reply)
Discussion started by: santiagorf
1 Replies
std::messages< _CharT >(3cxx)											     std::messages< _CharT >(3cxx)

NAME
std::messages< _CharT > - SYNOPSIS
Inherits std::locale::facet, and std::messages_base. Inherited by std::messages_byname< _CharT >. Public Types typedef int catalog typedef _CharT char_type typedef basic_string< _CharT > string_type Public Member Functions messages (size_t __refs=0) messages (__c_locale __cloc, const char *__s, size_t __refs=0) void close (catalog __c) const string_type get (catalog __c, int __set, int __msgid, const string_type &__s) const catalog open (const basic_string< char > &__s, const locale &__loc) const catalog open (const basic_string< char > &, const locale &, const char *) const Static Public Attributes static locale::id id Protected Member Functions virtual ~messages () string_type _M_convert_from_char (char *) const char * _M_convert_to_char (const string_type &__msg) const virtual void do_close (catalog) const virtual string_type do_get (catalog, int, int, const string_type &__dfault) const template<> string do_get (catalog, int, int, const string &) const template<> wstring do_get (catalog, int, int, const wstring &) const virtual catalog do_open (const basic_string< char > &, const locale &) const Static Protected Member Functions static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw () static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) static void _S_destroy_c_locale (__c_locale &__cloc) static __c_locale _S_get_c_locale () static const char * _S_get_c_name () throw () static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) Protected Attributes __c_locale _M_c_locale_messages const char * _M_name_messages Detailed Description template<typename _CharT>class std::messages< _CharT > Primary class template messages. This facet encapsulates the code to retrieve messages from message catalogs. The only thing defined by the standard for this facet is the interface. All underlying functionality is implementation-defined. This library currently implements 3 versions of the message facet. The first version (gnu) is a wrapper around gettext, provided by libintl. The second version (ieee) is a wrapper around catgets. The final version (default) does no actual translation. These implementations are only provided for char and wchar_t instantiations. The messages template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the messages facet. Definition at line 1695 of file locale_facets_nonio.h. Member Typedef Documentation template<typename _CharT > typedef _CharT std::messages< _CharT >::char_type Public typedefs. Definition at line 1701 of file locale_facets_nonio.h. template<typename _CharT > typedef basic_string<_CharT> std::messages< _CharT >::string_type Public typedefs. Definition at line 1702 of file locale_facets_nonio.h. Constructor &; Destructor Documentation template<typename _CharT > std::messages< _CharT >::messages (size_t__refs = 0) [explicit] Constructor performs initialization. This is the constructor provided by the standard. Parameters: refs Passed to the base facet class. Definition at line 45 of file messages_members.h. template<typename _CharT > std::messages< _CharT >::messages (__c_locale__cloc, const char *__s, size_t__refs = 0) [explicit] Internal constructor. Not for general use. This is a constructor for use by the library itself to set up new locales. Parameters: cloc The C locale. s The name of a locale. refs Refcount to pass to the base class. Definition at line 51 of file messages_members.h. template<typename _CharT > std::messages< _CharT >::~messages () [protected], [virtual] Destructor. Definition at line 80 of file messages_members.h. Member Data Documentation template<typename _CharT > locale::id std::messages< _CharT >::id [static] Numpunct facet id. Definition at line 1713 of file locale_facets_nonio.h. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 std::messages< _CharT >(3cxx)
All times are GMT -4. The time now is 11:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy