Hi,
I have a problem with a random number generating function. This function works great on windows XP but when I run the function in Windows VISTA and Windows 7, I receive an error message that displays:
"Attempted to read or write protected memory. This is often an indication that other memory has been corrupted"
(I dont know if this is because I mix mananged and unmanaged code. I did find the srand a good random function from the unmanaged code so this is why I have mixed it here)
int Start = 0 int Start = 0;
int End = 50;
int NumberResults = 100;
std::vector<int> FillData;
int Number5 = 0;
std::string Dummy;
System::String^ text;
srand((unsigned)time(nullptr));
for( int i = 0; i < NumberResults + 1; i++ )
{
Number5 = rand() % (End - Start + 1) + Start;
stringstream v1;
std::string v2;
v1 << Number5;
v2 = v1.str();
String^ Number = gcnew String(v2.c_str());
this->textBox1->Text = text;
this->textBox1->Multiline = true;
this->textBox1->WordWrap = false;
text += Number + System::Environment::NewLine;
}