Считывание c++

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by qmen, 23 Aug 2012.

  1. qmen

    qmen New Member

    Joined:
    23 Dec 2010
    Messages:
    63
    Likes Received:
    1
    Reputations:
    0
    Здравствуйте,у меня вопрос.Можно ли реализовать на c++ мгновенное считывание клавиатуры без дожидания нажатия ENTER.Заранее благодарю.
     
  2. patcher

    patcher Banned

    Joined:
    15 Dec 2009
    Messages:
    190
    Likes Received:
    37
    Reputations:
    10
    getch() не?
     
  3. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,732
    Likes Received:
    809
    Reputations:
    230
    Можно. Как? - Google
     
    _________________________
  4. qmen

    qmen New Member

    Joined:
    23 Dec 2010
    Messages:
    63
    Likes Received:
    1
    Reputations:
    0
    а можно пример как использовать эту функцию?В гугл примеров внятных не увидел.
     
  5. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,732
    Likes Received:
    809
    Reputations:
    230
    http://www.coldestgame.com/site/blog/cybertron/non-blocking-reading-stdin-c
     
    _________________________
  6. qmen

    qmen New Member

    Joined:
    23 Dec 2010
    Messages:
    63
    Likes Received:
    1
    Reputations:
    0
    Я там ничего не понял,можно мне код программы которая бы сразу считывала,и заносила в массив.
    Заранее спасибо.
     
  7. cheater_man

    cheater_man Member

    Joined:
    13 Nov 2009
    Messages:
    651
    Likes Received:
    44
    Reputations:
    7
    int main()
    {
    char ch,p;
    int i = 0;
    while(in){
    in.get(ch);
    p[i++]= ch;
    }
     
    1 person likes this.
  8. Geass

    Geass New Member

    Joined:
    12 Apr 2012
    Messages:
    43
    Likes Received:
    2
    Reputations:
    0
    Одну закрывающую фигурную пропустили ;)
     
  9. qmen

    qmen New Member

    Joined:
    23 Dec 2010
    Messages:
    63
    Likes Received:
    1
    Reputations:
    0
    Спасибо,ставлю вам +
     
  10. qmen

    qmen New Member

    Joined:
    23 Dec 2010
    Messages:
    63
    Likes Received:
    1
    Reputations:
    0
    А что означает "in" в while(in) ?
    У меня просто компилятор на while(in) ругается
    И почему ругается и на гет: undefined reference to "get".
    (Компилятор Codeblocks GNU GCC COMPILER)
     
    #10 qmen, 23 Aug 2012
    Last edited: 23 Aug 2012
  11. mrfreeze

    mrfreeze New Member

    Joined:
    4 Apr 2012
    Messages:
    13
    Likes Received:
    0
    Reputations:
    0
    Переводчиком воспользоваться мама запрещает?
    До тех пор, пока in не равно нулю
     
Loading...