From: "Ingo Ruhnke" Newsgroups: comp.os.msdos.djgpp Subject: problem with readkey() Date: 16 Oct 1997 19:21:35 GMT Organization: Telemedia News Server Lines: 45 Message-ID: <01bcda6c$d9e94d80$0200a8c0@ingo> NNTP-Posting-Host: gtso-m71-239.pool.mediaways.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I got here some simple code which dosen't run as I expect it to work: #include #include void main() { allegro_init(); install_keyboard(); if (readkey() == 'a') { printf ("a was pressed"); } else { printf ("a wasn't pressed"); } } this didn't get me the info about that was pressed, it said every time "a wasn't pressed", but if i modify it to this: void main() { char c; /* ^^^^^^ */ allegro_init(); install_keyboard(); if ((c = readkey()) == 'a') { /* ^^^^ */ printf ("a was pressed"); } else { printf ("a wasn't pressed"); } } the programm works fine. Can anybody tell me why this is so. And if i use getchar() instead of readkey() it also works like expected, so were is the problem which this code. Thanks Ingo -- Ingo Ruhnke ruhnke AT owl-online DOT de http://www.geocities/SiliconValley/Horizon/2159