Ok does anyone no why im getting these errors
gjc.c:72: warning: passing arg 1 of `fopen' makes pointer from integer without a cast
gjc.c:77: warning: format argument is not a pointer (arg 2)
gjc.c:82: warning: passing arg 1 of `fopen' makes pointer from integer without a cast
gjc.c:87: warning: format argument is not a pointer (arg 2)
And could someone double check my makefile just in case iv done it wrong please?
Code:
#include "gjc.h"
#include "gjc_options.h"
#include "gjc_utility.h"
int main(int argc, char* argv[])
{
GJCType menu;
return EXIT_SUCCESS;
}
int commandLineArguments(int argc, char *argv)
{
/* declaration of variables*/
/* declare file pointers to files*/
FILE *menu;
FILE *submenu;
/* command line argument*/
/* checks to see if 3 command line arguments have been entered*/
if(argc<3)
{
printf("Invalid: Enter 3 command line arguments (Error:)\n");
exit(ERRORCODE);
}
else if(argc >3)
{
printf("Too many arguments where supplied\n");
return ERRORCODE;
}
/* check to see if the proper .dat names have been passed*/
/* if(argc==3 && !strcmp(argv[1], "menu"))
{
printf("Cannot find filename wrongly entered\n");
return ERRORCODE;
}*/
/*
if(argc==3 && !strcmp(argv[2], "submenu"))
{
printf("Cannot find filename\n");
return ERRORCODE;
}*/
/* opening the menu.dat file for reading*/
menu = fopen(argv[1], "r");
/* check to see if the file exists*/
if(menu ==NULL)
{
printf("Im sorry %s does not exit(ERROR!)\n", argv[1]);
return ERRORCODE; /* cannot proceed*/
}
/* opening the submenu file for reading*/
submenu = fopen(argv[2], "r");
/* check to see if the subMenu file exists*/
if(submenu ==NULL)
{
printf("The file %s does not EXIST(ERROR!)\n", argv[2]);
return ERRORCODE; /* cannot proceed*/
}
return EXIT_SUCCESS;
}
makefile
Code:
all: gjc.o gjc_utility.o gjc_options.o
gcc -gstabs -o gjc gjc.o gjc_utility.o gjc_options.o
gjc.o: gjc.c gjc.h
gcc -gstabs -Wall -ansi -pedantic -c gjc.c
gjc_options.o: gjc_options.c gjc_options.h
gcc -gstabs -Wall -ansi -pedantic -c gjc_options.c
gjc_utility.o: gjc_utility.c gjc_utility.h
gcc -gstabs -Wall -ansi -pedantic -c gjc_utility.c
clean:
rm gjc gjc.o gjc_options.o gjc_utility.o