Thread: CString to char*

  1. #1

    CString to char*

    I have a function that accepts a parameter of type char*, but I am using a CString type, not a char array, how can I convert it?

    Thank you

  2. #2
    you are using VC++, is it? you may try to replace char * to CString first, perhaps some more for correspondence variables in function. Did you tried? In fact, CString can do easily what char * does(as I know).

  3. #3
    Registered User
    Join Date
    Nov 2001
    Try this:

    // YourFunction(char *text);

    CString string("test");


  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    look into CStrings GetBuffer() member function.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

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