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. .NET issue

.NET issue

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiodebugginghelpquestion
6 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.
  • K Offline
    K Offline
    kjessee
    wrote on last edited by
    #1

    The following code works in VS 6 debug/release. Works in debug in VS .NET, but locks up in release. CString Desc; // All others are double while ( fscanf (LoadFile, "%lf %lf %lf %lf %lf %d %[_0-9 a-zA-Z]", &m_dTemp, &m_dIce, &m_dWind, &m_dTension, &m_dK, &m_iCode, Desc) != EOF) { m_cboLoads.AddString( cDesc ); } The fscanf is causing the lock up with the CString. Any ideas, or avenues of research? thanks

    C P 2 Replies Last reply
    0
    • K kjessee

      The following code works in VS 6 debug/release. Works in debug in VS .NET, but locks up in release. CString Desc; // All others are double while ( fscanf (LoadFile, "%lf %lf %lf %lf %lf %d %[_0-9 a-zA-Z]", &m_dTemp, &m_dIce, &m_dWind, &m_dTension, &m_dK, &m_iCode, Desc) != EOF) { m_cboLoads.AddString( cDesc ); } The fscanf is causing the lock up with the CString. Any ideas, or avenues of research? thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Convert your program to C++ ? Seriously, C file handling is SO ugly. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      K 1 Reply Last reply
      0
      • C Christian Graus

        Convert your program to C++ ? Seriously, C file handling is SO ugly. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        K Offline
        K Offline
        kjessee
        wrote on last edited by
        #3

        Yes, I have been putting that off. What is best way to read formated text from a file with c++. Example: 0.00 0.50 4.00 0.600 0.30 1 NESC Heavy 32.00 0.50 0.00 0.000 0.00 0 32 Deg -20.00 0.00 0.00 0.000 0.00 0 Uplift 60.00 0.00 0.00 0.350 0.00 1 Load 60.00 0.00 0.00 0.250 0.00 2 No Wind 60.00 0.00 0.00 0.000 0.00 2 CREEP CHECK 90.00 0.00 0.00 0.000 0.00 0 90 Deg F 120.00 0.00 0.00 0.000 0.00 0 120 Deg F 167.00 0.00 0.00 0.000 0.00 0 167 Deg F 212.00 0.00 0.00 0.000 0.00 0 212 Deg F 302.00 0.00 0.00 0.000 0.00 0 HOT

        C 1 Reply Last reply
        0
        • K kjessee

          Yes, I have been putting that off. What is best way to read formated text from a file with c++. Example: 0.00 0.50 4.00 0.600 0.30 1 NESC Heavy 32.00 0.50 0.00 0.000 0.00 0 32 Deg -20.00 0.00 0.00 0.000 0.00 0 Uplift 60.00 0.00 0.00 0.350 0.00 1 Load 60.00 0.00 0.00 0.250 0.00 2 No Wind 60.00 0.00 0.00 0.000 0.00 2 CREEP CHECK 90.00 0.00 0.00 0.000 0.00 0 90 Deg F 120.00 0.00 0.00 0.000 0.00 0 120 Deg F 167.00 0.00 0.00 0.000 0.00 0 167 Deg F 212.00 0.00 0.00 0.000 0.00 0 212 Deg F 302.00 0.00 0.00 0.000 0.00 0 HOT

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          I'd use a struct so I could stream them in one go - read my article on iostream inserters and extrators. The problem would be that your string at the end is able to have a space in it. There are multiple ways to handle this, but the first that comes to mind is to read the floats in directly, as in #include #include std::ifstream strm("c:\\my file.txt"); float a,b,c,d,e; std::string suffix; while (strm.good()) { strm << a << b << c << d << e; std::getline(strm, suffix); // process each line here } that's off the top of my head, so not guarenteed to be production code, or even to compile :-) You get the idea though. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

          1 Reply Last reply
          0
          • K kjessee

            The following code works in VS 6 debug/release. Works in debug in VS .NET, but locks up in release. CString Desc; // All others are double while ( fscanf (LoadFile, "%lf %lf %lf %lf %lf %d %[_0-9 a-zA-Z]", &m_dTemp, &m_dIce, &m_dWind, &m_dTension, &m_dK, &m_iCode, Desc) != EOF) { m_cboLoads.AddString( cDesc ); } The fscanf is causing the lock up with the CString. Any ideas, or avenues of research? thanks

            P Offline
            P Offline
            Prakash Nadar
            wrote on last edited by
            #5

            First of all i dont know how is this related to dot.net Desc in has not been allocated any string.. so use it this way in the scanf Desc.GetBuffer(20) and after the scanf call Desc.ReleaseBuffer this should work. cheers. The World is getting smaller and so are the people.

            K 1 Reply Last reply
            0
            • P Prakash Nadar

              First of all i dont know how is this related to dot.net Desc in has not been allocated any string.. so use it this way in the scanf Desc.GetBuffer(20) and after the scanf call Desc.ReleaseBuffer this should work. cheers. The World is getting smaller and so are the people.

              K Offline
              K Offline
              kjessee
              wrote on last edited by
              #6

              Because it works in version 6, it does not work in .NET. I will try your suggestion as a fix until I get everything converted to c++. I am glad I know what was wrong though, :) thank you

              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