Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6721413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:19:39+00:00 2026-05-26T09:19:39+00:00

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684969(v=vs.85).aspx error C2664: ‘ReadConsoleOutputCharacterW’ : cannot convert parameter 2 from ‘char *’ to ‘LPWSTR’

  • 0

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684969(v=vs.85).aspx
error C2664: ‘ReadConsoleOutputCharacterW’ : cannot convert parameter 2 from ‘char *’ to ‘LPWSTR’

#include <windows.h>
#include <stdio.h>

int main(void)
{
    HANDLE hOut;
    char letter;
    char letters[5];
    DWORD numberRead;
    COORD where_;

    SetConsoleTitle(L"Hello!");
    hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    where_.X = 0;
    where_.Y = 0;
    ReadConsoleOutputCharacter(hOut, &letter, 1, where_, &numberRead);
    printf("letter at (0,0) is %c letter", letter);
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:19:40+00:00Added an answer on May 26, 2026 at 9:19 am

    It seems you are compiling with unicode support enabled (because ReadConsoleOutputCharacter resolves to ReadConsoleOutputCharacterW, otherwise it would resolve to ReadConsoleOutputCharacterA).

    This means all strings and characters used with any WinAPI functions need to be wide characters WCHAR instead of char and LPWSTR instead of LPSTR, …. Or you disable unicode by undefining the appropriate preprocessor symbols (UNICODE and _UNICODE, I think). But in this case your SetConsoleTitle call won’t work anymore, as you explicitly pass it a wide string.

    But the most flexible would be to use TCHAR instead of char and LPTSTR instead of LPSTR and the like. These are just defined to the correct types depending on the definition of the UNICODE preprocessor symbol. In this case the code stays widely independent of unicode support. But in this case you have to wrap all string literals in the _T, T or TEXT macro:

    //non-unicode
    const char *str = "something";
    
    //unicode
    const WCHAR *str = L"something";
    
    //unicode-agnostic
    const TCHAR *str = _T("something");
    

    See here for an introduction to the problem.

    If you don’t really need unicode support and only need some simple WinAPI functions and want them to interface well with the C standard library (like in your case it seems), it would be the best idea to just undefine UNICODE and _UNICODE and use standard chars. In this case also remove the L modifier from your string literals.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx Is there an equivalent in DX10? If
According to http://msdn.microsoft.com/en-us/library/windows/desktop/bb509610(v=vs.85).aspx HLSL supports conditional operator (since version 2.0? I am using 4_0)
I'm trying to use the WMI example from msdn: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384724%28v=vs.85%29.aspx I've copied the last
On Windows Mobile metod InternetSetOption http://msdn.microsoft.com/en-us/library/ms918381.aspx does not support option INTERNET_OPTION_HTTP_DECODING is there some
According to http://msdn.microsoft.com/en-us/library/aa916070.aspx (DnsQuery_W), DNS query libraries are available on Windows Mobile / CE
Is there any alternative for WPF (windows presentation foundation) in python? http://msdn.microsoft.com/en-us/library/aa970268.aspx#Programming_with_WPF
I just read about the reference device' device type in direct3D. http://msdn.microsoft.com/en-us/library/windows/desktop/bb219625(v=vs.85).aspx Does this
I've read up on how WPF handles the shutdown event. http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode.aspx However in my
I tried using http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx#Y399 but when I do this throw new ArgumentNullException(playlist is empty);
According to http://msdn.microsoft.com/en-us/library/system.windows.forms.linklabel.aspx , the LinkLabel class has both a Click event inherited from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.