detecting usb connection

Blakus2:
Hi All, I'm having trouble finding a way to detect if the pc usb cable is connected to the ardunino.
The idea is to only send out data via the serial output when the cable is plugged in to the pc.
I have a program running that I need to access now and then for monitoring or data retrieval.
Currently it has the serial info permanently enabled and so if I pull out the cable the program resets and similarly when I plug it back in. I can't work out how can use "!serial" or "if(exists)" or if indeed that is possible. The plan is to be able to plug the cable in and read data and take it out again without disturbing the program operation.
Cheers!! ....... Mike B

if you repetitively send a signal from the PC over Serial every few seconds (eg. "OK") a sort of wake up, you can use that as the trigger that the Arduino responds...