how to convert a 'const char *' to 'char *' in vc++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jsl
    New Member
    • May 2007
    • 7

    how to convert a 'const char *' to 'char *' in vc++

    how to convert a 'const char *' to 'char *' in vc++
  • svlsr2000
    Recognized Expert New Member
    • Feb 2007
    • 181

    #2
    You can use casting operators to do so.

    Comment

    • xoinki
      New Member
      • Apr 2007
      • 110

      #3
      const char *ask = "so easy";
      char *temp = NULL;

      temp = (char *)ask;

      try this..
      Xoinki

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        But if it const for a good reason then you will need to create a buffer of your own and copy it there.

        Comment

        • jsl
          New Member
          • May 2007
          • 7

          #5
          Originally posted by xoinki
          const char *ask = "so easy";
          char *temp = NULL;

          temp = (char *)ask;

          try this..
          Xoinki
          thank you Xoinki, it has solved my problem

          Comment

          Working...