Re[2]: [Dev-C++] how to do a shell like input..
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ca...@kr...> - 2003-04-26 13:05:05
|
hi!
ok, then I got down to this little snippet. thanks to your help.
a buffer overflow won't come I think but can there be a EOF before
'\n' on stdin???
<snip>
#define BUFFER_MAX_SIZE 4096 // <- I think this limit is even
// used in the bash
int i = 0;
char c;
char buffer[BUFFER_MAX_SIZE];
while((c = getchar()) != '\n')
if(i < BUFFER_MAX_SIZE) buffer[i++] = (c == '\n') ? 0 : c;
</snap>
gruss
/Christian mailto:ca...@kr...
---
I propose that the following character sequence for joke markers:
:-)
19-Sep-82 11:44 Scott E Fahlman
|