Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. String to char *array

String to char *array

Scheduled Pinned Locked Moved Visual Studio
c++questionvisual-studiodata-structureshelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shirani
    wrote on last edited by
    #1

    Hey dudes! I am using VS 2005 and doing work in Visual C++ windows Applications. I am facing a prob that i have a class in which my data members are char * but when i get data from text box or edit box it is in the form of String. But i have to convert it into char*. How can i do it?? I got how to convert char * to string by COnvert::ToString(char*). And other one problem is that when i add a class, when i add data member as String or String^ it didn't allow me. To do it which header file Should i include??

    Regards: Xohaib Shirani

    P S 2 Replies Last reply
    0
    • S Shirani

      Hey dudes! I am using VS 2005 and doing work in Visual C++ windows Applications. I am facing a prob that i have a class in which my data members are char * but when i get data from text box or edit box it is in the form of String. But i have to convert it into char*. How can i do it?? I got how to convert char * to string by COnvert::ToString(char*). And other one problem is that when i add a class, when i add data member as String or String^ it didn't allow me. To do it which header file Should i include??

      Regards: Xohaib Shirani

      P Offline
      P Offline
      Perspx
      wrote on last edited by
      #2

      This question may be more relevant in the C++/MFC forum. Regards, --Perspx

      "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

      S 1 Reply Last reply
      0
      • P Perspx

        This question may be more relevant in the C++/MFC forum. Regards, --Perspx

        "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

        S Offline
        S Offline
        Shirani
        wrote on last edited by
        #3

        Yea i know it's the question of C++ but when i use the same application in .NEt. i can include . But it didn't allow me to add in VS 2005 :( so what should i do ?? I tried using namsespce std and using system std. So how can i include the file ???? I did the same work in .Net 2003 envirnment

        Regards: Xohaib Shirani

        1 Reply Last reply
        0
        • S Shirani

          Hey dudes! I am using VS 2005 and doing work in Visual C++ windows Applications. I am facing a prob that i have a class in which my data members are char * but when i get data from text box or edit box it is in the form of String. But i have to convert it into char*. How can i do it?? I got how to convert char * to string by COnvert::ToString(char*). And other one problem is that when i add a class, when i add data member as String or String^ it didn't allow me. To do it which header file Should i include??

          Regards: Xohaib Shirani

          S Offline
          S Offline
          shubhi
          wrote on last edited by
          #4

          declare a myCharPtr which doesn't have any embedded nulls and be sure that it is large enough. And use following command- strcpy(myCharPtr, my_string.c_str()) I think it should work...but not sure.

          "We can't solve problems by using the same kind of thinking we used when we created them"

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups