All pastes #769662 Raw Edit

Mine

public c v1 · immutable
·published 2007-11-11 16:41 UTC
rendered paste body
char* getInput(){  int length = 0;  int input = 0;  char *text = malloc(_STEP_ + 1);  if (NULL==text)    return NULL;  while((input = getchar()) != EOF)  {    if ( (_STEP_ - 1) == (length % _STEP_) )    {      if (NULL == realloc(text, ( (length + 1) + _STEP_ + 1)))      {        free(text);        return NULL;      }    }    text[length] = input;    length++;  }  text[length] = '\0';  return text;}