开发者

How to use scanf in Objective-C?

friends how to use the scanf in the objective c when i am compiling it is working开发者_StackOverflow中文版 nicely but during the run time it is getting the infinitely... pls give me the solution for this thanks in advance.....


scanf is not useful for iPhone programs as there is no facility to run in console mode.

sscanf is sometimes useful but you are probably better off using NSNumberFormatter.

For more info see:

  • Using Scanf with ObjC and iPhone

  • Is there any way of reading from stdin on iPhone, either hardware or emulator?


Always check the return value of scanf.

check = scanf(...);
if (check != EXPECTED_VALUE) hanlde_error();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜