How to map the file of jpg or bmp directly on the quads?

I have tried to convert the file of jpg or bmp to the two dimensional array. But I do not know how to convert the units of the array whose type might be “double” to the “GLubyte” type

Why not to look at the redbook?
Chapter 9. Texture Mapping, Example 9-1 : Texture-Mapped Checkerboard: checker.c