All pastes #769659 Raw Edit

Mine

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