|
From: <ca...@kr...> - 2003-04-25 12:23:03
|
hi dev-cpp-users,
I try the following code:
<snip>
#include <stdio.h>
int main(int argc, char** argv)
{
char buffer[5];
while(1)
{
printf("prompt > ");
scanf("%4[^\n]",buffer);
printf("you typed: %s\n", buffer);
printf("you typed: %d %d %d %d %d\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4]);
}
return 0;
}
</snap>
but it obviously doesn't work.
I want to emulate a console behaviour.
so that whenever you press <ENTER>
-the just typed letters (only 4 of them) get placed in buffer (with a
terminating 0)
-buffer gets printed
-buffer gets cleared
-stdin gets cleared
-new prompt waiting for input ()
how can i do that?
gruss
/Christian mailto:ca...@kr...
---
I propose that the following character sequence for joke markers:
:-)
19-Sep-82 11:44 Scott E Fahlman
|