Entering no character for input in C -
is there way user enter nothing input(for character array) in c? tried following:
- using
'\n'
character delimiter:scanf("%[^\n]s",str);
gave me junk. - used custom delimiter ' ` '. additional task required in case if entered in between, etc.
- tried using command line arguments input string (as know no input gives
one argument expected
) - tried entering
null
alt+space
. did not work either.
please suggest me new way or correct me if doing of above steps wrong. note: using windows.
if take input command line arguments, can specify empty string with:
c:\>myprogram ""
argc
2
, argv[1]
pointer empty string.
Comments
Post a Comment