/* * Data file from http://yann.lecun.com/exdb/mnist/ * 2006.10.26 A.Date */ #include #include #include #define IMAGE_FILE "train-images-idx3-ubyte" #define NUM_IMAGES 60000 #define SIZE 784 /* 28 x 28 */ static int num[10]; static unsigned char image[NUM_IMAGES][SIZE]; /* * Read the training images into memory */ void read_images() { int i, j,k, fd; char image_name[80]; float f; unsigned char * ptr; if ((fd=open(IMAGE_FILE,O_RDONLY))==-1){ printf("couldn't open image file"); exit(0); } /* skip headers */ read(fd,num, 4*sizeof(int) ); for (i=0; i