>> // S should be Capital
You should use "%hs". I recommend that you forget that %S even exists - use %s, %ls, or %hs.

>> // Now again we convert TCHAR to Double by using _wtof function
You should use _ttof().

gg