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. Problems with Visual C++ Version 6

Problems with Visual C++ Version 6

Scheduled Pinned Locked Moved C / C++ / MFC
c++announcementdebugginghelp
3 Posts 2 Posters 15 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have a simple C++ console application (same problem with MFC application) that uses character strings. With Version 6, the debug version crashes when it tries to read the character string. However, the release version works fine. With Version 5, both the debug and release versions work fine. ------------------------------------------------------ #include #include #define MAXENTRIES 2 main () { char* szNames[MAXENTRIES]={"1234567890", "1234567890"}; for (int i=0; i < MAXENTRIES; i++) { cout << "Input a name: "; assert (szNames[i]); cin >> szNames[i]; cout << "You have input: " << szNames[i] << endl; } return (0); }

    M 1 Reply Last reply
    0
    • L Lost User

      I have a simple C++ console application (same problem with MFC application) that uses character strings. With Version 6, the debug version crashes when it tries to read the character string. However, the release version works fine. With Version 5, both the debug and release versions work fine. ------------------------------------------------------ #include #include #define MAXENTRIES 2 main () { char* szNames[MAXENTRIES]={"1234567890", "1234567890"}; for (int i=0; i < MAXENTRIES; i++) { cout << "Input a name: "; assert (szNames[i]); cin >> szNames[i]; cout << "You have input: " << szNames[i] << endl; } return (0); }

      M Offline
      M Offline
      Michael Owen
      wrote on last edited by
      #2

      Subby, For each of the names that you entered in, how many characters were typed in? Check for a buffer overflow ( especially on the 2nd name ). - Mike ================== The original message was: I have a simple C++ console application (same problem with MFC application) that uses character strings. With Version 6, the debug version crashes when it tries to read the character string. However, the release version works fine. With Version 5, both the debug and release versions work fine.
      ------------------------------------------------------
      #include
      #include

      #define MAXENTRIES 2

      main ()
      {
      char* szNames[MAXENTRIES]={"1234567890", "1234567890"};

      for (int i=0; i < MAXENTRIES; i++) {
      cout << "Input a name: ";
      assert (szNames[i]);
      cin >> szNames[i];
      cout << "You have input: " << szNames[i] << endl;
      }

      return (0);
      }

      L 1 Reply Last reply
      0
      • M Michael Owen

        Subby, For each of the names that you entered in, how many characters were typed in? Check for a buffer overflow ( especially on the 2nd name ). - Mike ================== The original message was: I have a simple C++ console application (same problem with MFC application) that uses character strings. With Version 6, the debug version crashes when it tries to read the character string. However, the release version works fine. With Version 5, both the debug and release versions work fine.
        ------------------------------------------------------
        #include
        #include

        #define MAXENTRIES 2

        main ()
        {
        char* szNames[MAXENTRIES]={"1234567890", "1234567890"};

        for (int i=0; i < MAXENTRIES; i++) {
        cout << "Input a name: ";
        assert (szNames[i]);
        cin >> szNames[i];
        cout << "You have input: " << szNames[i] << endl;
        }

        return (0);
        }

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        your appl crushs because you are trying to write to const variable there was a bug in VC++5, but in VC++6 is fixed. ================== The original message was: Subby,

        For each of the names that you entered in, how many characters were typed in? Check for a buffer overflow ( especially on the 2nd name ).

        - Mike

        ==================
        The original message was:

        I have a simple C++ console application (same problem with MFC application) that uses character strings. With Version 6, the debug version crashes when it tries to read the character string. However, the release version works fine. With Version 5, both the debug and release versions work fine.
        ------------------------------------------------------
        #include
        #include

        #define MAXENTRIES 2

        main ()
        {
        char* szNames[MAXENTRIES]={"1234567890", "1234567890"};

        for (int i=0; i < MAXENTRIES; i++) {
        cout << "Input a name: ";
        assert (szNames[i]);
        cin >> szNames[i];
        cout << "You have input: " << szNames[i] << endl;
        }

        return (0);
        }

        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