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. C / C++ / MFC
  4. string to char* conversion

string to char* conversion

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++dotnetcomdebugging
9 Posts 4 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.
  • D Offline
    D Offline
    dalbhide bipin
    wrote on last edited by
    #1

    Hi I am building my tool in VC++ 2008 and it is non /clr based. I want the code that converts string to char* and it should be non clr based. I set project property "Common language runtime" as "No Common language runtime". http://support.microsoft.com/kb/311259\[^\] This link provides me solution to my problem but for that i have to set project property "Common language runtime" as a "Common language runtime support" which i don't want. Because if i change it gives me an error fatal error C1113: #using failed on 'h:\bipin\b.e\kpit proj\copy control\temp\dllproject\debug\dllproject.lib' Here is my code string snos; c1.ReadPhysicalDriveInNTWithZeroRights(snos); fuction reads hard disk serial number and stores it into "snos". Thanking you.

    H T 2 Replies Last reply
    0
    • D dalbhide bipin

      Hi I am building my tool in VC++ 2008 and it is non /clr based. I want the code that converts string to char* and it should be non clr based. I set project property "Common language runtime" as "No Common language runtime". http://support.microsoft.com/kb/311259\[^\] This link provides me solution to my problem but for that i have to set project property "Common language runtime" as a "Common language runtime support" which i don't want. Because if i change it gives me an error fatal error C1113: #using failed on 'h:\bipin\b.e\kpit proj\copy control\temp\dllproject\debug\dllproject.lib' Here is my code string snos; c1.ReadPhysicalDriveInNTWithZeroRights(snos); fuction reads hard disk serial number and stores it into "snos". Thanking you.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      I think you asked this question and delete your question,right(one hours ago)?

      D 1 Reply Last reply
      0
      • D dalbhide bipin

        Hi I am building my tool in VC++ 2008 and it is non /clr based. I want the code that converts string to char* and it should be non clr based. I set project property "Common language runtime" as "No Common language runtime". http://support.microsoft.com/kb/311259\[^\] This link provides me solution to my problem but for that i have to set project property "Common language runtime" as a "Common language runtime support" which i don't want. Because if i change it gives me an error fatal error C1113: #using failed on 'h:\bipin\b.e\kpit proj\copy control\temp\dllproject\debug\dllproject.lib' Here is my code string snos; c1.ReadPhysicalDriveInNTWithZeroRights(snos); fuction reads hard disk serial number and stores it into "snos". Thanking you.

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        so you think deleting your previous post and reposting it exactly the same again will change something ? just wondering : why are you insisting that much about the CLR thing ? you want what exactly ? convert a C++ string (std::string) to a C style string (char*) ? or you want to get the HDD serial number anyway ? BTW, where are you taking this function from ?

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        J 1 Reply Last reply
        0
        • H Hamid Taebi

          I think you asked this question and delete your question,right(one hours ago)?

          D Offline
          D Offline
          dalbhide bipin
          wrote on last edited by
          #4

          I though ur not getting it. so i deleted my previous question. you want what exactly ? convert a C++ string (std::string) to a C style string (char*) ? ya toxcct i want that.

          H T 2 Replies Last reply
          0
          • D dalbhide bipin

            I though ur not getting it. so i deleted my previous question. you want what exactly ? convert a C++ string (std::string) to a C style string (char*) ? ya toxcct i want that.

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            See here[^].

            D 1 Reply Last reply
            0
            • D dalbhide bipin

              I though ur not getting it. so i deleted my previous question. you want what exactly ? convert a C++ string (std::string) to a C style string (char*) ? ya toxcct i want that.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              the std::string class has a c_str() function which returns a char*...

              std::string str = "Hello World";
              char psz[20] = {0};

              ::strcpy(str.c_str(), psz);

              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              1 Reply Last reply
              0
              • H Hamid Taebi

                See here[^].

                D Offline
                D Offline
                dalbhide bipin
                wrote on last edited by
                #7

                thanks

                1 Reply Last reply
                0
                • T toxcct

                  so you think deleting your previous post and reposting it exactly the same again will change something ? just wondering : why are you insisting that much about the CLR thing ? you want what exactly ? convert a C++ string (std::string) to a C style string (char*) ? or you want to get the HDD serial number anyway ? BTW, where are you taking this function from ?

                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  toxcct wrote:

                  just wondering : why are you insisting that much about the CLR thing ?

                  Maybe because searching MSDN for string returns tons of System.String links but almost no std::string links. MS is pushing us heavily in the direction of .NET.

                  Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
                  Douglas Adams, "Dirk Gently's Holistic Detective Agency"

                  T 1 Reply Last reply
                  0
                  • J jhwurmbach

                    toxcct wrote:

                    just wondering : why are you insisting that much about the CLR thing ?

                    Maybe because searching MSDN for string returns tons of System.String links but almost no std::string links. MS is pushing us heavily in the direction of .NET.

                    Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all.
                    Douglas Adams, "Dirk Gently's Holistic Detective Agency"

                    T Offline
                    T Offline
                    toxcct
                    wrote on last edited by
                    #9

                    hum, yes, probably, but i don't read the MSDN, i just KNOW it ! lol

                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    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