When I debug an OSX application from Xcode, I can communicate with the application console from the Xcode debugging console - for example, the application can printf() to stdout and displayed on the Xcode debugging console, and my application can call fgets() on stdin to which I can Enter input into the Xcode debug console.
It looks like Xcode when debugging iPhone iOS applications connects stdout ( printf() et. Al., Works fine), but not stdin ?
Has anyone done stdin on iOS / iPhone? This would be very helpful when debugging - even when using the Cocoa iOS app. I could make this work in a more complex way, for example using a socket, but I would prefer Xcode to do this for me.
UPDATE:
Well, that will explain it. The iOS simulator actually opens /dev/null for stdin . You can find out where stdout going (usually /dev/ttys00X ), and then reopen it with O_RDONLY and assign it stdin. This works great for an iOS simulator, but it seems like the linear discipline for connecting the iphone to the iphone device in series is wrong - you can continue to type in the xcode debug console and never go to the iphone hardware (and your program runs on the iPhone hardware just sits, expecting something to appear on stdin aka /dev/ttys00X ).
I wonder if there is a way to make this work with iPhone hardware?
source share