hy all i am facing a problem in this code
Code:
/*file.c */
#include "file.h"
#include<string.h>
char *get_file_path(char *buffer)
{
int count;
char *path;
for(count=0;buffer[count]!='\0';count++)
{
if(buffer[count]=='/')
{
path=&buffer[count];
break;
}
}
for(count=0;path[count]!='\0';count++)
{
switch((*buffer+count))
{
case ' ':
path[count]='\0';
break;
}
}
return path;
}
char *get_file_name(char *buffer)
{
char *name;
name=strrchr(buffer,'/');
return name;
}
Code:
/*file.h*/
#if defined(file)
#else
#define file
char *get_file_path(char *buffer);
char *get_file_name(char *buffer);
#endif
Code:
/* source code*/
#include<stdio.h>
#include<string.h>
#include "file.h"
#define BUF 250
main()
{
FILE *fp,*lp,*cp,*pp;
char word[10],copy[BUF],buffer[BUF],*path,*name;
printf("\nHy I am What We Gonna Do Is Getting The Files That You Will Enter It's
Extnasion:");
fgets(word,10,stdin);
fp=fopen("c:\hh.txt","rb");
lp=fopen("log.txt","rb");
if((fp==NULL)&&(lp==NULL))
fprinf(stderr,"\nError In Opining File IN File %s Line %d",__FILE__,__LINE__);
while((fgets(buffer,BUF,fp))!=NULL)
{
path=get_file_path(buffer);
name=get_file_name(path);
if(((pp=fopen(path,"rb"))!=NULL)&&(cp=fopen(name,"ab"))!=NULL)
{
while((fgets(copy,BUF,pp))!=NULL)
{
fputs(copy,cp);
}
fclose(pp);
fclose(cp);
}
}
fprintf(stderr,"\nComplet");
fclose(fp);
fclose(lp);
return (0);
}
i am using dev-cpp compiler
and i can't compile it the error is
[Linker error] undefined reference to `get_file_path'
[Linker error] undefined reference to `get_file_name'
ld returned 1 exit status
what is the problem now ?
help