What I'm wondering is how running programs communicate with each other, and if someone could post some sample code for how to do this, so I can try it out myself, just for educational purposes.For example, I've worked with databases before, and in my code I always have to establish a connection to the database. The database service has to be running before I start my program, or else it will fail. What exactly is going on with that connection and how does it work?
How do you call one program from another?
c++;database;c
Any sort of communication with the outside world is ultimately mediated by the operating system. There's various mechanisms available for Inter-process communication, but pipes and network sockets are probably some of the most common. If you've ever piped the output of one program into another on a command line shell, those processes were communicating with a pipe. The connection to the database you mentioned is using a network socket, perhaps with a custom protocol. For communicating separate machines in a fairly universal way, you'd probably go with a web service, which generally means passing information through HTTP and possibly XML.