Thread: Cutting up an std::string

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    1) A string does not have a fixed size, so setting a string equal to a char pointer to an empty char array does nothing:

    Materials[i].TextureFilename = new char[strlen( pMaterial->m_texture )+1];

    2) Look up strcpy() and see what parameter types it can take:

    strcpy( Materials[i].TextureFilename, pMaterial->m_texture );

    3) Read my second post again.
    Last edited by 7stud; 03-31-2006 at 10:57 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 12-14-2007, 03:34 PM
  2. std::string: Has my compiler gone nuts??
    By Andruu75 in forum C++ Programming
    Replies: 9
    Last Post: 09-28-2007, 04:02 AM
  3. Improving my code
    By rwmarsh in forum C++ Programming
    Replies: 14
    Last Post: 07-08-2006, 11:18 AM
  4. Debugging help
    By cuddlez.ini in forum C++ Programming
    Replies: 3
    Last Post: 10-24-2004, 07:08 PM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM