|
|
Help
Directory
Bjorfck Silas:
Hey, I'm having a bit of trouble
implementing unbuffered input using the
Linux API. I'll probably end up using
opengl or SDL's built-in event
architecture, but it would probably be
nice to have something standalone right
now to minimize complications during
testing. I found getch() in the win32
libs, but that doesn't exist in Linux.
Ned Bingham:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int c;
system("stty raw");
while(1)
{
c = getc(stdin);
if(c == 27)
break;
printf(": c = %d\n", c);
}
system("stty sane");
}
Bjorfck Silas:
Ah! Wizardry. Thanks. By the way, I've
been looking at some of the innovative
work Douglas Engelbart did in the 60's
on IU and various interface systems. It
might be a neat model for future
ClustorOS GUI plans.
Bjorfck Silas:
System()'s fucking awesome! I think I'd
been too lazy in the past to find
whatever command did that...epic.
Ned Bingham:
There are a few other ways to get
non-buffered input, but I thought the
system function would be the easiest
way. I've been trying to find Douglas's
work, but I am having trouble. Could you
point me to a site so I could check it out?
Daniel Bingham:
Woah, you guys actually sound like real
computer geeks. When did that happen? ;)
PS. Here's a less hacky solution:
http://www.cplusplus.com/reference/iostream/streambuf/pubsetbuf.html
Use that function called from an
initialized fstream class with both
parameters set to zero to do unbuffered
input.
cplusplus.com is an excellent resource.
So is google ;)
Ned Bingham:
Zomg!! real computer geeks?!?!
Cool!...... Wow, I feel like a fraud :P
Enter New Post
|
|