S
siliconwafer
Hi All,
I want to take a string from stdin(say login Name).But I don't want a
static array of fixed size.I don't want to restrict user to a
perticular sizeof login name.
So I want to allocate memory dynamically to hold the name depending on
size of name.
One way of doing is:
malloc(strlen(gets(char*))+1);
But I read in forum that gets is unsafe and fgets requires a fixed size
which I don't want the user to restrict to.
How can I get away with the problem?
By the way,what is the max size of a login name & password for popular
websites & mail sites?
-Siliconwafer.
I want to take a string from stdin(say login Name).But I don't want a
static array of fixed size.I don't want to restrict user to a
perticular sizeof login name.
So I want to allocate memory dynamically to hold the name depending on
size of name.
One way of doing is:
malloc(strlen(gets(char*))+1);
But I read in forum that gets is unsafe and fgets requires a fixed size
which I don't want the user to restrict to.
How can I get away with the problem?
By the way,what is the max size of a login name & password for popular
websites & mail sites?
-Siliconwafer.