summaryrefslogtreecommitdiffstats
path: root/friendfinder/read_file.c
blob: cdbf684ebae4d8aced8776b01d0c907d015c6fe1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdlib.h>
#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;
} 
/*
void write_png(DmtxImage *img)
{
	FILE *fw;  
 	fw = fopen("file.txt", "w");

	if (fw == NULL)
	{
		printf("READ_FILE: image could not have been wrote \n");
		return;
	}
	
	if (fw != NULL)
		{
			
		}
}*/