All pastes #190457 Raw Edit

Stuff

public text v1 · immutable
·published 2006-10-04 00:29 UTC
rendered paste body
static void
read_input(char *buf, int bufsize)
{
    int i = 0;
    int pos = 0, maxbuf = bufsize - 1;
    char c;
    
    while (!feof(stdin) && (i < maxbuf) && (c = getchar()) != '\n')
    {
        buf[pos++] = c;
    }
    buf[pos++] = '\0';
}