It looks like you have a code that once supported multi-byte and UNICODE but decayed after stopped being compiled for multi-byte (no more supporting Windows 95).
This code snipped makes sense only if you have _UNICODE
defined. In this case it end like this after the pre-processor:
wchar_t Curr_dir[100];
char* input_file;
unsigned long a = GetCurrentDirectoryW(100, Curr_dir);
size_t i= wcstombs(&input_file[i], Curr_dir, 100);
In this case the GetCurrentDirectoryW
returns a UINCODE (wide string) in Curr_dir
and it's converted, for some whatever reason, to a multi-byte string. And the types of the chars match.
But if _UNICODE
is not defined it the code changes to the following:
char Curr_dir[100];
char* input_file;
unsigned long a = GetCurrentDirectoryA(100, Curr_dir);
size_t i= wcstombs(&input_file[i], Curr_dir, 100);
And GetCurrentDirectoryA
now switches to the ANSI version of the API it makes no sense to call wcstombs
anymore.
Usually the MDSN documentation has a section with a table with all versions of a string function under Generic-Text Routine Mappings ( for example strcmp-wcscmp-mbscmp
) There is no '_t' version of the wcstombs
so you need to use #ifdef _UNICODE
.
But even if the the multi-byte version of the Win32 API may be still supported it makes no sense to keep using them.
More: https://www.codeproject.com/articles/76252/what-are-tchar-wchar-lpstr-lpwstr-lpctstr-etc