back to sqaure 1.
Code:
char *a=argv[2];
char *b=argv[3];
char buf[20];
sprintf(buf, "%s/%s", a, b);
char buf2[20];
sprintf(buf2, "%s/%s", b, a);
FILE* instream=fopen(a,"r");
FILE *instream2=fopen(b,"r");
/*if the file is not there, but inside a directory*/
if(instream==NULL){
instream=fopen(buf2,"r");
}
if(instream2==NULL){
instream2=fopen(buf,"r");
}
/*check whether the file open is success or not*/
if((instream == NULL) || (instream2 == NULL))
{
printf("File Open Error!");
exit(2);
}
produces FILE OPEN ERROr?