Q:

How to make all polygons into triangles

I need to create test file for my program. But it only accepts polygons with 3 vertices - triangles as input. How can I convert all polygons of some object into triangles?
I know how to select all faces, but how to split them into triangles. 

A:

You can select all the faces and go to Mesh> Faces> Triangulate Faces in the 3D View header (or just press Ctrl+T for the same effect) while in Edit Mode.
As ideasman42  pointed out in the comments, Mesh> Faces> Poke Faces (accessible with Alt+P) will also triangulate the mesh by adding a vertex in the center of each face and fan-filling around the vertex, it may give preferred results for certain cases, for example, cylinder caps.
You could also add a 'Triangulate' modifier to the object and apply it:

Visualisation of the two methods:

