Skip to content

Instantly share code, notes, and snippets.

@jiunbae
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiunbae/b46bad5980729dade842 to your computer and use it in GitHub Desktop.
Save jiunbae/b46bad5980729dade842 to your computer and use it in GitHub Desktop.
raw_input with Cpp
#include<stdlib.h>
char * input(void)
{
register char ch, * string = (char*)calloc(sizeof(char), sizeof(int));
for (register int count = 0; (string[count] = getchar()) != '\n' || (string[count] = 0); string = (char*)realloc(string, sizeof(char)*++count + sizeof(int)));
return string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment