Conversation
Notices
-
@kirby @histoire
here's what I crapped out to avoid stdio, if you look at it funny it may explode and it's horribly complicated (but it works). One thing in your example I wouldn't do is having it realloc that frequently, also the sizeof probably wouldn't work since it would just be giving the size of the char pointer. I might try to do a gnu version as well
terrible.png
-
@sysrq @histoire was thinking of
char x;
int i = 0;
char* buff = malloc(1);
while (x!='\n')
{
x = getchar();
buff[i] = x;
i++;
realloc(buff, sizeof(buff)+1);
}
// done
realloc(buff, sizeof(buff)+1);
buff[sizeof(buff)] = '\0';
Sorry for the shiddy code too lazy to retype all of that shid on a phone