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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. conversion from char* to string

conversion from char* to string

Scheduled Pinned Locked Moved ATL / WTL / STL
3 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.
  • G Offline
    G Offline
    gReaen
    wrote on last edited by
    #1

    hello, My code snippet for conv is as follows: string temp_file; temp_file = my_dir; temp_file += string ("\\file.tmp"); the my_dir is externed from some other file n is char* with a directory path as its value ("C:\\Projects"). i'm gettin an exception n the application closes. i want to know wat is the mistake i'v been doing. Thanx in advance

    The problems that exist in the world today cannot be solved by the level of thinking that created them. - Albert Einstein

    H J 2 Replies Last reply
    0
    • G gReaen

      hello, My code snippet for conv is as follows: string temp_file; temp_file = my_dir; temp_file += string ("\\file.tmp"); the my_dir is externed from some other file n is char* with a directory path as its value ("C:\\Projects"). i'm gettin an exception n the application closes. i want to know wat is the mistake i'v been doing. Thanx in advance

      The problems that exist in the world today cannot be solved by the level of thinking that created them. - Albert Einstein

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

      See here[^].

      1 Reply Last reply
      0
      • G gReaen

        hello, My code snippet for conv is as follows: string temp_file; temp_file = my_dir; temp_file += string ("\\file.tmp"); the my_dir is externed from some other file n is char* with a directory path as its value ("C:\\Projects"). i'm gettin an exception n the application closes. i want to know wat is the mistake i'v been doing. Thanx in advance

        The problems that exist in the world today cannot be solved by the level of thinking that created them. - Albert Einstein

        J Offline
        J Offline
        Johann Gerell
        wrote on last edited by
        #3

        So, instead of giving you a fish, I'll teach you how to catch lots of fish all by yourself. The course is called Debugging 101:

        gReaen wrote:

        string temp_file;

        1. Breakpoint there. 2. Observe the involved variables. 3. Is something smelly? That's the thief. Goto 6. 4. Step. Exception thrown? If so, you should have smelled it in 3. 5. Goto 2. 6. End. It's likely the assignment (will call string::assign et al under the hood, to which you have the sources and should therefore find the error source) that throws because my_dir is in fact NULL, not "C:\\Projects".

        -- Time you enjoy wasting is not wasted time - Bertrand Russel

        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