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; }