Basic collision detection

hey,

I’m having some trouble with some basic collision algorithms (not all of them, but some). These are:
A circle-square detection (2D). I can detect the ‘collision’, but I treat the circle as if it were a square. So how do you calculate the corner collisions of a square-circle (So at the vertices of a square)?
Also, I would like to know how to perform a line-line detection.

Thanks in advance