This commit is contained in:
Thomas Schleicher 2023-09-19 11:11:44 +02:00
parent 9d150c04c5
commit f98bb5cbaa
4 changed files with 26 additions and 7 deletions

20
image.c
View file

@ -1,10 +1,12 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include "image.h"
#include "matrix.h"
Img** import_images(char* image_file_string, char* label_file_string, int number_of_images) {
Image** import_images(char* image_file_string, char* label_file_string, int number_of_images) {
// create file pointer for the image and label data
FILE* image_file = fopen(image_file_string, 'r');
@ -12,9 +14,23 @@ Img** import_images(char* image_file_string, char* label_file_string, int number
// check if the file could be opened
if(image_file == NULL || label_file == NULL) {
printf("ERROR: File could not be opened! ()");
printf("ERROR: File could not be opened! (import_images)");
}
do {
ch = fgetc(label_file);
printf("%c", ch);
// Checking if character is not EOF.
// If it is EOF stop reading.
} while (ch != EOF);
// allocate memory for the storage of images
// Image** images = malloc(sizeof(Image) * number_of_images);
fclose(image_file);
fclose(label_file);
}
void img_print (Img* img) {