So, to clarify, you want to know how jailbreaking works internally? Or do you want to know, as per the question title, how you can connect to an iphone with c++?
I don't know about iPhones, but if they're anything like Android devices, you can't, at least, not directly.
There's basically three ways a program running on a PC can connect to a program running on an Android device:
1. Through a network socket. This is what the majority of user mode applications do. You have to go through the network, which is kind of silly if the device is already connected through USB to the system.
2. Through a network socket that passes through an emulated connection (that actually uses the USB connection) created by the debugging service. This is more like what one would expect to do, but it has the problem of requiring the device to be in debug mode.
3. Write a USB driver for the PC OS that will mediate the connection between the PC program and the Android program (I can't remember at the moment if the Android OS also needs a driver). This is what sync applications do. The solution has several obvious drawbacks, but it's the only way to directly interface Android and PC applications using the USB link.
helios is right. As of now, and probably for the foreseeable future, there is no official way to connect to an iPhone in C++. Everything that exists uses jailbreak hacks, and those hacks use the network. However, you *can* use AppleScript to do basic things with an iPhone, and it will recognize when an iPhone is plugged in. (link:http://apple.stackexchange.com/questions/88849/applescript-to-run-when-iphone-connects-disconnects )