read lenght of string from stdin
Posted
by teoz
on Stack Overflow
See other posts from Stack Overflow
or by teoz
Published on 2010-05-29T10:56:50Z
Indexed on
2010/05/29
11:02 UTC
Read the original article
Hit count: 187
I want to take a string from stdin but I don't want a static array of fixed size
i knew that scanf need something where save the stdin input, but i can't do something like this:
char string[10]
scanf("%s",string);
becouse i need to knew before how long will be the string in order to allocate the right memory space
can you help me to resolve this problem?
© Stack Overflow or respective owner