I was writing a small program just to mess around and suddenly I got an error that
I was wondering what causes them, and kinda what do they indicate?Run-Time Check Failure #2 - Stack around the variable 'letter' was corrupted.
Here is the entire offending code...
Perhaps I am just tired(which I am) but I see nothing wrong with it. If anyone could enlighten me, perhaps you can help my tired eyes see what I am doing wrong. Thanks.Code:#include "stdafx.h" #include <iostream> #include <stdlib.h> #include <time.h> #include <sstream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { stringstream st; srand( (unsigned)time(NULL) ); for( int i = 0; i < 256; i++ ) { int num = rand() % 65; num += 65; char letter; itoa( num, &letter, 10 ); st << letter; } string theString = st.str(); cout << theString << endl; return 0; }



LinkBack URL
About LinkBacks


