Ive been working on this program for a little while now. and
i keep getting the error messages:
proj6b.c:61: error: syntax error before '{' token
proj6b.c:68: error: syntax error before '{' token
ive looked over the code and cant seem to find were the problem is. I am also a newbie,
any help would great because this beast is due at 8 am.
#include <stdio.h>
#include <string.h>
#define STR_SIZE 25
#define ARR_SIZE 10
#define MAX 25
typedef struct
{
char month [MAX];
int day;
int year;
}DATE;
typedef struct
{
char firstname[MAX];
char lastname[MAX];
DATE birthday;
char social[12];
}INFO;
int fillArray(FILE *inf, char arr[]);
void printArray(char arr[], int numEls);
void accessfile (FILE *inf, INFO *record);
int main(int argc , char *argv[])
{
int numEls;
DATE bday;
// SSN snum;
FILE *inf;
INFO first[STR_SIZE];
INFO last[STR_SIZE];
DATE month;
DATE day;
DATE year;
char arr[ARR_SIZE];
enum months {January = 1, February, March, April, May, June, July,
August, September, November, December};
enum months DateMonth;
inf = fopen(argv[1], "r");
printf("its got this far\n");
printf("%d%s%s\n", month, &first, &last);
numEls = fillArray(inf, arr);
printArray(arr, numEls);
fclose(inf);
return 0;
}
int fillArray(FILE *inf, char arr[]);
{
int i;
for(i = 0; i < STR_SIZE; i++)
accessfile(arr[i]);
}
void printArray(char arr[], int numEls);
{
int i ;
for (i = 0; i < numEls; i++)
printf("Name: %s, %s\n", last,first );
}
void accessfile (FILE *inf, INFO *record)
{
if ((inf = fopen("argv[1]", "r")) != NULL)
{
fscanf(inf, "%s, %s %s %s %d, %d", record->firstname,
record->lastname, record->social,
record->birthday.month, record->birthday.day,
record->birthday.year);
// fillarray(arr[]);
fclose(inf);
}
else
printf("\nUnable to open \"argv[1]\" for reading.\n\n");
}