#include "stdio.h" char* read_key() { FILE *fr; int key_value; char key_string; char *key = (char(*)[300]) malloc(sizeof(char) * 300); //supports max keylength of 300 int i = 0; fr = fopen ("key.pem", "rt"); if (fr == NULL) { printf("READ_FILE: key could not have been read \n"); return NULL; } if (fr != NULL) { while((key_value = fgetc(fr)) != EOF) { key_string = (char) key_value; key[i] = key_string; i++; } } fclose(fr); return key; }