Hello, I have a question, if you please.
I have been trying to fill an array with values from a text file for hours. I has been 12 years since I have used any C code, and I thought I would be able to remember this. I have an opportunity to use C at work and I am doing a self study tutorial but the code from the book(online) doesn't seem to work properly. Would someone take a look and tell me what I am doing wrong here? I have tried several combinations of things. This is a little program called Clue and it should have only taken me a few hours to do but it has taken me all day to get this far. I am using a DEV_C compiler
My struct
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ARR_SIZE 100
#define TRUE 1
typedef struct {
char subject[50];
char relation[50];
char object[50];
int string_size;
} FACTS ;
MY fill ARRAY Function
char fillArray(){
FILE *cFile;
int i,j,k;
char *array[ARR_SIZE];
char c;
cFile = fopen ("Clue.dat","r"); /*Reopen the file input*/
printf("\n\nThe Array contains: \n\n");
while((c=getc(cFile))!=EOF) {
printf("%c",c);
// for (i=0; i <ARR_SIZE; i++){
// strcpy(array[i],&c);
}
//for (i=0; i <ARR_SIZE; i++){
// c=getc(cFile);
//for (j=0; j < 50; j++){
// strcpy(array[j],&c);
//for (k=0; k < ARR_SIZE; k++){
//array[i][j][k]=c;
}
//}
Some lines of clue.dat
Lord Dunsmore?is married to?Lady Emily
Miss Secrest?called?the Inspector
The gardener?is married to?the maid
Poison?can be procured by?a blood relative
Mr. Mason?visited?at 3:00 P.M.