Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode Compiler Error Fix #214

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

AMZN-Gene
Copy link

@AMZN-Gene AMZN-Gene commented Dec 3, 2024

Using TCHAR string to fix compiler error when compiling with UNICODE
TCHAR automatically resolves to wchar or char depending if unicode is enabled or not.

Resolves #213

HANDLE hFile =
CreateFile(filepath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr,
CreateFile(tFilepath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr,
Copy link

@spham-amzn spham-amzn Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of possibly converting the filename to a char or wide character, why no use CreateFileA directly so it always uses char? CreateFile is really a macro that switches between CreateFileA and CreateFileW based on the unicode switch anyways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual Studio Compile Fail when Unicode Enabled: CreateFile() Requires LPCWSTR File Name
3 participants