Hi,
this is my first post in this great forum.
I needed to produce an array of random numbers. so I decided to dumb the array to a file for testing purpose only. I used this function :
I opened the file using Notepad++ to see the file in hex mode, I got repeated values :Code:void GeneratePass( const char* passPath, size_t units ){ std::ofstream passFile; size_t *pass = new size_t[units]; srand( __time32_t(NULL) ); for( size_t C = 0; C < units; C++ ) pass[C] = rand(); passFile.open( passPath, std::ios::binary ); passFile.write( reinterpret_cast<char*>(&pass), units * sizeof(size_t) ); passFile.close(); delete[] pass; return; }
and I got something strange :
could someone please explain what's happening ??!!!
I am using VC++ 2008 Express, WinXP SP2.
Thanks..






Reply With Quote