Closed ghost closed 5 years ago
lil halp please
Are you compiling your program in Unicode mode? Try setting this option to "Not set".
Tried it, only got rid of the second error
You only posted one error...
No I mean the second line in the image
Wergh, install Gentoo.
@BohemianRahpGod There's only one line in the picture
... there are two lines there
I'm thinking I might have setup wrong, to 'install' rlutil do I just drag the rlutil.h to the project directory with the other headers?
There's one, wrapped, line in the picture.
You did the setup wrong: to complete it, you must sacrifice an infant of age three to five to Krampus, our benevolent lord and saviour.
ok brb
okay the baby is dead but I'm still getting errors
Well then, uninstall Windows and install Gentoo. Or try it with GCC on Windows (works for me).
But really how did I 'install' rlutil correctly?
rlutil
is a single-header header-only library. You put it anywhere your cimploler can find it and it works.
So what do you think the issue is if it's installed correctly
Wrong LPCWSTR
typedef, which probably means your Unicodeness macros are messed up
whut
Can you tell me what to check and what they should be?
I'll look at that thanks
Isn't that basically what I already said...
It is, but I pasted the first result from Google
Just change this line in the header file from: WriteConsoleOutputCharacter(hConsoleOutput, str, len, csbi.dwCursorPosition, &numberOfCharsWritten);
...to: WriteConsoleOutputCharacter(hConsoleOutput, (LPCWSTR)str, len, csbi.dwCursorPosition, &numberOfCharsWritten);
How about using WriteConsoleOutputCharacterA instead of WriteConsoleOutputCharacter ?
How about using WriteConsoleOutputCharacterA instead of WriteConsoleOutputCharacter ?
Works perfectly! Thank you, MangaD!
@Gibgezr
The function 'WriteConsoleOutputCharacter' calls either 'WriteConsoleOutputCharacterA' or 'WriteConsoleOutputCharacterW' depending on whether the preprocessor symbol UNICODE is defined. So your solution won't work if the ANSI version of the function is called. More info on this here: https://msdn.microsoft.com/en-us/library/windows/desktop/ff381407%28v=vs.85%29.aspx
So the solution would be using the 'WriteConsoleOutputCharacterA' function directly I believe. Otherwise you could use 'WriteConsoleOutputCharacterW' and do the conversion as you did... :)
This should work with or without UNICODE set. The fix is simple. Very annoying. I need to decide what to do and if I'm going to have to just make my own fork. Any update on if this will be fixed?
The simplest solution is just to use the proper version of the api call that uses multibyte, 'WriteConsoleOutputCharacterA' if you insist on using std::string regardless of the UNICODE being defined.
Here's how I did it, with a little help from Stack Overflow: / line 578 / unsigned int len = str_.size(); *_wchar_t fixStr = new wchart[len]; for (int i = 0; i < len; i++) { fixStr[i] = str[i]; }**
RLUTIL_INLINE void setString(RLUTIL_STRING_T str) {
unsigned int len = strlen(str);
HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD numberOfCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);
WriteConsoleOutputCharacter(hConsoleOutput, **_fixStr_**, len, csbi.dwCursorPosition, &numberOfCharsWritten);
And then I read everyone else's comments, changed it to WriteConsoleOutputCharacterA() and went on about my merry life.
I'm getting an error at line 584 "WriteConsoleOutputCharacter(hConsoleOutput, str, len, csbi.dwCursorPosition, &numberOfCharsWritten);". Error shown in photo attached.