scanf under the debugger
Comments and questions to John Rowe.
XCode has a problem whereby if you run a program under the debugger then
scanf does not work (it just hangs). Fortunately there is a
simple work-around:
- Make sure that the debugger is running before you start
your program
, i.e. that there is a
debug window open. If not open one with
Debug -> Debugger
- If you do not have a debugger window open before you start running your code it will
not show you the values of all your variables.
- Start the program in the normal way, either by clicking the
"Build and Go" button or from the menu using
Build -> Build and Run
- Your code will start running with its own console window. When
it stops for scanf there will be an icon at the top of
the console window with the word "Attach". When you click on it, the
debugger will attach itself to your program and pause.
- You can now click the "Continue" button on the degugger to
unpause your program.