If all faces are convex (they usually are), just turn them into the equivalent of triangle fans, i.e. the first triangle is vertices 0-1-2, the next is 0-2-3, the next 0-3-4, then 0-4-5, and so on.

Hey, thanks for your help.

I was thinking of doing the exact same thing before I asked here but couldn't figure it out, even after working on it for hours.

After messing around with the code a bit this morning I used your suggestion, and finally got a working loop that calculates all the triangles.(even for 32 sided cylinders)