Use WideCharToMultiByte ,replace for()

In order to be compatible with char .
use WideCharToMultiByte
change tchar to char.