Thread: cstring

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Whenever you ask a question about an error, ALWAYS post a message on the line that has the error, like this:
    Code:
    int n = 10.5;  //***ERROR***
    Or, post the error message along with the line of code:
    error message saying : cannot convert from 'std::string' to 'const char *'.
    which is this line of code:

    int n = 10.5;
    You can't assign a string type to a variable that is of type const char*. This code makes no sense:
    Code:
    string myStringErrors;
    ...
    const char* myStringNoSpaces = myStringErrors;
    string str(myStringNoSpaces)
    You try to convert myStringErrors from a string type to a const char*. Then you convert the result back to a string type. Hello? You had a string type to start with.
    Last edited by 7stud; 01-23-2007 at 06:39 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. Writing CObjects with Serialization to CArchive
    By ruben_gerad in forum C++ Programming
    Replies: 0
    Last Post: 11-09-2006, 08:25 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. Help with CString class and operator+ overloading
    By skanxalot in forum C++ Programming
    Replies: 2
    Last Post: 10-07-2003, 10:23 AM
  5. Operater overloading - (const char + CString)
    By auth in forum C++ Programming
    Replies: 14
    Last Post: 10-24-2002, 09:22 AM