Console Input

This is a discussion on Console Input within the Windows Programming forums, part of the Platform Specific Boards category; Code: HANDLE c; c = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); SetConsoleActiveScreenBuffer(c); .. ReadConsole(c, gpb, 1, (DWORD *)tmp, NULL) ...

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    Console Input

    Code:
    HANDLE c;
    c = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
    SetConsoleActiveScreenBuffer(c); 
    ..
    ReadConsole(c, gpb, 1, (DWORD *)tmp, NULL)
    ..
    ReadConsole is failing with error code 6, ERROR_INVALID_HANDLE, but I can print to the console fine :/

  2. #2
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    your handle is not valid.

  3. #3
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154
    I don't see why it shouldn't be, considering the fact I CAN WRITE TO IT

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    http://msdn.microsoft.com/library/de...attributes.asp

    I'm being really really lazy, but can you just run that and see if it works and how that applys with relation to your program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fscanf in different functions for the same file
    By bchan90 in forum C Programming
    Replies: 5
    Last Post: 12-03-2008, 09:31 PM
  2. For loop problems, input please.
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-22-2007, 04:54 AM
  3. Console input
    By ozzy34 in forum C++ Programming
    Replies: 9
    Last Post: 05-14-2004, 01:05 PM
  4. How to put a Char into the Input buffer of a console?
    By Aidman in forum C++ Programming
    Replies: 10
    Last Post: 03-09-2003, 10:05 AM
  5. Need help with Console Keyboard Input
    By pawelx2 in forum Game Programming
    Replies: 5
    Last Post: 05-31-2002, 12:03 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21