Sampling a texel array

Hi all,

I am trying to sample 2048x2048 lightmap texture, I get the texels into an unsigned char * before uploading the texture to vram, I now have the raw pixels to play with.
I want to sample these texels in my loop so I raycast the mesh find a uv coord using barycentric coordinates. Now I want to sample the texels using that uv coord.

My friend says its something roughly like this: color = texture[rounddown(texcoord0.x * width)][rounddown(texcoord0.y * height)]; but he is not 100% sure.

Any code samples would be extremely welcome.