Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there any way of reading from stdin on iPhone, either hardware or emulator?
    text
    copied!<p>When I debug an OSX application from XCode, I can communicate with the application's console from the XCode debugging console - for example, the application can <code>printf()</code> to <code>stdout</code> and that's displayed on the XCode debugging console, and my application can call <code>fgets()</code> on <code>stdin</code> to which I can type input in the XCode debug console.</p> <p>It seems like XCode, when debugging iOS iPhone applications, hooks up <code>stdout</code> (<code>printf()</code> et. al. work fine), but not <code>stdin</code>?</p> <p>Has anyone made <code>stdin</code> on iOS/iPhone work? This would be just tremendously useful during debugging - even with an iOS Cocoa app. I could get this to work in some more complicated way, like with a socket, but I'd just rather have XCode do this for me.</p> <p>UPDATE:</p> <p>Well, this would explain it. The iOS simulator actually opens <code>/dev/null</code> for <code>stdin</code>. It's possible to find out where <code>stdout</code> is going (typically <code>/dev/ttys00X</code>) and then reopen that with <code>O_RDONLY</code> and assign it to stdin. This works great for the iOS simulator, but it looks like the line discipline for the serial connection to the iphone hardware is wrong - you can keep typing input in the xcode debug console and it never gets sent to the iphone hardware (and your program running on the iPhone hardware will just sit waiting for something to show up on <code>stdin</code> aka <code>/dev/ttys00X</code>).</p> <p>I wonder if there's any way to get this working with the iPhone hardware?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload