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");
}

well i found the problems at line 61 and 67, but now im getting errors at line 52 and 63

Not sure if you care to add October?

enum months {January = 1, February, March, April, May, June, July, 
		August, September, November, December};

Anyways, looks like you copied and pasted from your prototypes
int fillArray(FILE *inf, char arr[]) ; <=== Delete the ;
{
int i;
for(i = 0; i < STR_SIZE; i++)
accessfile(arr);
}

AND

void printArray(char arr[], int numEls) ; <=== Delete the ;
{
int i ;
for (i = 0; i < numEls; i++)
printf("Name: %s, %s\n", last,first );

}

Open the file in vi and match braces.

That has to be the one most useful features of any program editor, other than of course the ability to type. And most good editors have it -- probably stolen from vi. It doesn't work well though if the code contains braces in quotes.

This article has been dead for over six months. Start a new discussion instead.