Can't add an array with data to shared memory

view story

http://stackoverflow.com – I am trying to write a file with data into my shared memory segment. However everything I have tried seems just to give the error Segmentation fault. I have been searching the internet for help for more then one day. int main(int argc, char *argv[]). { int sm; char *data; int pid=atoi(argv[1]); int key=atoi(argv[2]); char (*d)[1025]; data=(char*) malloc(1025); //put the data in the shared memory segment FILE *file=fopen(argv[3], "r"); //r for read if (file==0) {printf("Could not open file");} else { while(fgets(data, 1025, file)!=NULL) (HowTos)