Read string in Objective-C console application?
What is the best way to read string input from a simple Objective-C console application?
I would just like to store the input as an NSString variable.
I've seen multiple people post about scanf
, gets
and others, but they everyone seems to sa开发者_如何学运维y that they're "unreliable", or "open to attack".
I can see how this could be true for gets
but I'm looking for the best possible way to do this.
Thanks!
scanf should be mostly secure as long as you use your input correctly.
I've heard of scanf_s which is supposed to be more secure but work the same way.
精彩评论