I have the header file as:
test.h
//Mandatory fields size macro
#define size_uid 65
#define size_txn 33
#define size_adhaarNo 13
#define size_ver 4
#define size_input 65
#define size_photo 1024*1024*10
#define size_pseudonym 50
#define size_name 50
//Mandatory fields declaration
char uid[size_uid];
char txn[size_txn];
char adhaarNo[size_adhaarNo];
char ver [size_ver];
char *photo;
char pseudonym[size_pseudonym];
char name[size_name];
char input[size_input];
void incorrect_val_test(FILE *, FILE *, FILE *, FILE *, FILE *, FILE *,FILE *,FILE *,FILE *,FILE*);
test.c
#include "test.h"
//Mandatory fields declaration
char uid[] = "865A80A01C70A9E0D5FC5F4D354A9155BF58CD483B1397C92614E5BC92317ACC";
char txn[] = "23da7b99-c561-4102-9df8-d37fbfe1";
char adhaarNo[] = "250241800087";
char ver [] = "1.0";
char *photo = (char *)malloc(sizeof(char)*size_photo);
char pseudonym[] = "2b6c55566d14459991513fb00bce34ed";
char name[] = "Amarjeet Sharma";
char input[] = "936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af";
void incorrect_val_test(FILE *ver, FILE *ts, FILE *txn, FILE *vtxn, FILE *uid, FILE *input, FILE *adhaarNo, FILE *photo, FILE *name, FILE *pseudonym)
{
//Some initialization and files are opened here....
photo = (char *)malloc(sizeof(char)*size_photo);
FILE *photos = fopen("./input/data.txt","r");
if(photos == NULL)
{
printf("Can't open data file.\n");
return;
}
i=0;
while((read_char = fgetc(photos))!= EOF)
{
if(read_char == '\n')
continue;
photo[i]= read_char;
i++;
}
// Some more processing done here
}
main.c
int main()
{
// Some files are opened here to read data.
incorrect_val_test(fp_ver, fp_ts, fp_txn, fp_vtxn, fp_uid, fp_input, fp_adhaarNo, fp_photo, fp_name, fp_pseudonym);
return 0;
}
When I am compiling it gives the following error message
error message
warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
photo = (char *)malloc(sizeof(char)*size_photo);
error: incompatible types when assigning to type ‘FILE {aka struct _IO_FILE}’ from type ‘char’
photo[i]= read_char;
Can anybody point me where I am going wrong?