Problems with Visual C++ Version 6
-
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); }
-
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); }
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);
} -
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);
}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);
}