If your file has more than 50 characters, your program corrupts memory.
Code:
wchar_t arry[50];
//...
int i=0;
while ( ! inputfile.eof() )         
{
   arry[i] = inputfile.get();
Once i reaches 50, all bets are off as to what will happen.

Regards,

Paul McKenzie