reading a char string of variable size in C
ok .. so we want to read a char string of a variable size ..
we first get the BUF_SIZE:
we make room for the buffer:
buf = (char*) malloc(BUF_SIZE);
.. this gives segmentation fault:
fscanf(stdin, "%s", buf);
.. what is the correct way to read the char string into buf ?