How do we access Vert, Norm and UV data then print to a text file using Blender/Python? Basically, I've been trying to implement the code from the following page but I'm having difficulty tying the subtleties together.

Get indices of vertices of triangulated faces in python

The block that is over a light gray rectangle is the array that will be passed to a VBO.  That is what I'd like that output from Blender to look like.

For the example code I am using, I would like to change every instance of the following: 

print(indices)
or
print(plain_verts)

into something that will print to a text file in a specified folder on my hardrive.

***To address a comment that was made:***My question has nothing really to do with C/C++, what I am looking for is the Blender Python equivalent so that I can end up with the same file which is the Vertex, normals and uvCoords. In a 1 dimensional floating point array.  Basically I need a Python script that can emulate the following code.  I want to replace all the fluff below with a script that is run from within Blender.  


So basically, how do I end up with text with a file that has something like the following in it?  By using Python in Blender.  

For example it would be called  modelName.txt and would contain the following.

GLfloat modelName[] = 
{
    vertex, normal, uv,      #Vertex 1 
    vertex, normal, uv,      #Vertex 2
    vertex, normal, uv,      #Vertex 3 
};
In order to export the triangles of the default scene's cube the process would be as follows.


Select the Cube, switch to Edit Mode
Select all faces
Load the Texture in UV-Image Editor 
UV-Unwrap U Smart UV-Project
Create a Material and Texture , assign the texture and UV-Map
Convert the quads to tris Ctrl-F Ctrl-T
Switch to Object Mode (Important)


Run the script:

import bpy

#bpy.ops.mesh.quads_convert_to_tris()

ob = bpy.context.object

with open("c:\\tmp\\{ob.name}.txt".format(ob=ob), "w") as file:
    file.write("GLfloat {ob.name}[] =\n{\n".format(ob=ob))

    for face in ob.data.polygons:
        for vert, loop in zip(face.vertices, face.loop_indices):
            coord = ob.data.vertices[vert].normal
            normal = ob.data.vertices[vert].co
            uv = ob.data.uv_layers.active.data[loop].uv
            file.write("\t{co.x}, {co.y}, {co.z}, {n.x}, {n.y}, {n.z}, {uv.x}, {uv.y},\n".format(co=coord, n=normal, uv=uv))

    file.write( "};\n")


Find the output file in the temp directory:

GLfloat Cube[] =  
{
    0.577349, 0.577349, -0.577349, 1.000000 1.000000 -1.000000, 0.666667, 0.333333,
    0.577349, -0.577349, -0.577349, 1.000000 -1.000000 -1.000000, 1.000000, 0.333333,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 1.000000, 0.666667,
    0.577349, 0.577349, 0.577349, 1.000000 0.999999 1.000000, 0.333333, 0.666667,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 0.333333, 0.333333,
    0.577349, -0.577349, 0.577349, 0.999999 -1.000001 1.000000, 0.666667, 0.666667,
    0.577349, 0.577349, -0.577349, 1.000000 1.000000 -1.000000, 0.333333, 0.333333,
    0.577349, 0.577349, 0.577349, 1.000000 0.999999 1.000000, 0.000000, 0.333333,
    0.577349, -0.577349, -0.577349, 1.000000 -1.000000 -1.000000, 0.333333, 0.000000,
    0.577349, -0.577349, -0.577349, 1.000000 -1.000000 -1.000000, 0.333333, 0.333333,
    0.577349, -0.577349, 0.577349, 0.999999 -1.000001 1.000000, 0.333333, 0.000000,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 0.666667, 0.333333,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 0.666667, 0.000000,
    -0.577349, -0.577349, 0.577349, -1.000000 -1.000000 1.000000, 1.000000, 0.000000,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 1.000000, 0.333333,
    0.577349, 0.577349, 0.577349, 1.000000 0.999999 1.000000, 0.000000, 0.333333,
    0.577349, 0.577349, -0.577349, 1.000000 1.000000 -1.000000, 0.333333, 0.333333,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 0.000000, 0.666667,
    -0.577349, 0.577349, -0.577349, -1.000000 1.000000 -1.000000, 0.666667, 0.666667,
    0.577349, 0.577349, -0.577349, 1.000000 1.000000 -1.000000, 0.666667, 0.333333,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 1.000000, 0.666667,
    0.577349, 0.577349, 0.577349, 1.000000 0.999999 1.000000, 0.000000, 0.333333,
    0.577349, -0.577349, 0.577349, 0.999999 -1.000001 1.000000, 0.000000, 0.000000,
    0.577349, -0.577349, -0.577349, 1.000000 -1.000000 -1.000000, 0.333333, 0.000000,
    0.577349, 0.577349, -0.577349, 1.000000 1.000000 -1.000000, 0.333333, 0.333333,
    -0.577349, 0.577349, -0.577349, -1.000000 1.000000 -1.000000, 0.333333, 0.666667,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 0.000000, 0.666667,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 0.333333, 0.333333,
    -0.577349, -0.577349, 0.577349, -1.000000 -1.000000 1.000000, 0.666667, 0.333334,
    0.577349, -0.577349, 0.577349, 0.999999 -1.000001 1.000000, 0.666667, 0.666667,
    -0.577349, 0.577349, -0.577349, -1.000000 1.000000 -1.000000, 0.666667, 0.333333,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 0.666667, 0.000000,
    -0.577349, 0.577349, 0.577349, -1.000000 1.000000 1.000000, 1.000000, 0.333333,
    0.577349, -0.577349, 0.577349, 0.999999 -1.000001 1.000000, 0.333333, 0.000000,
    -0.577349, -0.577349, 0.577349, -1.000000 -1.000000 1.000000, 0.666667, 0.000000,
    -0.577349, -0.577349, -0.577349, -1.000000 -1.000000 -1.000000, 0.666667, 0.333333,
};


The code is based on ideasman42 answer here: Exporting UV coordinates

.blend file as demo.