read length 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:12 UTC
Read the original article
Hit count: 238
I want to take a string from stdin but I don't want a static array of fixed size
I know 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 know 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