Results 1 to 4 of 4

Thread: char [30] = CString? How do I do it?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    9

    char [30] = CString? How do I do it?

    I have a char array of 30. How do I convert a CString so I can assign the values to the array? Thanks.

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    9
    Ah. nevermind found it again.

    Code:
    strcpy(MyCharArray,(LPCTSTR) MyCString);

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No good way, screws up CString's memory management. Simply do
    Code:
    char ar[30] = "Helloooooojjjjjhhhhhgggggffff";
    CString str;
    str = ar;
    // or
    CString str2(ar);
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    9
    Thanks, but I was looking for something that will do ar = str. strcpy() seems to do it correctly.

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