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();
精彩评论