1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Solve This Linker error (Please Urgntly)

Discussion in 'C' started by pranav_535, Apr 29, 2008.

Thread Status:
Not open for further replies.
  1. pranav_535

    pranav_535 New Member

    when i tried to compile this program it showing

    Linker Error: Undefined symbol _FILLBOX in module DR.C

    the actual c program
    Code:
    //Save it as DR.C
    
    #include<dos.h>
    #include<dir.h>
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    #include<ctype.h>
    #include<alloc.h>
    #include<mem.h>
    #include<signal.h>
    #include<io.h>
    #include<errno.h>
    #include<bios.h>
    #include<process.h>
    #include<sys\stat.h>
    /*#include"tool.h"*/
    
    char path[401],MaxLines=20,NORMTXT=(1<<4)|15,HLTXT=(3<<4),drives[26],sorttype=0;
    char TITLETXT=7<<4,DEFTXT=7,MSGTXT=(4<<4)|15,HELPTXT=7<<4;
    char TITLEHL=(7<<4)|2,pattern[14]="*.*",temp[401],SYSTXT=(1<<4)|14;
    char SELTXT=(1<<4)|14;
    int SND=700;
    
    struct ffblk *flist=NULL;
    
    int showfiles();
    char *apath;
    
    void main(int argc,char *argv[])
    {
    int i;
    char buf[4],*ptrstr;
    getcwd(path,400);
    hidecursor();
    textattr(DEFTXT);
    clrscr();
    ptrstr=strrchr(argv[0],'\\');
    i=strlen(argv[0])-strlen(ptrstr)+1;
    apath=(char *)malloc(i);
    strncpy(apath,argv[0],i);
    apath[i]='\0';
    set_sighnd();
    drives[0]=1;
    drives[1]=1;
    for(i=2;i<26;i++)
     {
     buf[0]=i+65;
     buf[1]=':';
     buf[2]='\\';
     buf[3]='\0';
     if(!chdir(buf))
      {
      drives[i]=1;
      }
     else
      drives[i]=0;
     }
    chdir(path);
    if(argc>1)
      {
      setdisk(toupper(argv[1][0])-65);
      chdir(argv[1]);
      }
    gotoxy(1,25);
    textattr(SYSTXT);
    clreol();
    cprintf("File Manager 1.0 ³ Done by : Jeyakumar M S ³ Year : 2003");
    showfiles();
    window(1,1,80,25);
    textattr(7);
    clrscr();
    setdisk(toupper(path[0])-65);
    chdir(path);
    showcursor();
    }
    
    
    
    select_drive()
    {
    int i;
    window(42,2,80,5);
    textattr(DEFTXT);
    clrscr();
    getch();
    }
    
    void fn(int no)
    {
    char *err[]={"Abort","Floating Point Trap","Illegal Instruction",\
    			 "Interrupted","Memory Access Violation","Terminate"};
    gotoxy(1,25);
    if(no<6)
     printf("Error Occured ( ERR# %u ) : %s",no,err[no]);
    else
     printf("Error Occured ( ERR# %u ) : Unknown",no);
    }
    
    set_sighnd()
    {
    signal(SIGABRT,fn);
    signal(SIGFPE,fn);
    signal(SIGILL,fn);
    signal(SIGINT,fn);
    signal(SIGSEGV,fn);
    signal(SIGTERM,fn);
    }
    
    hidecursor()
    {
    _AH=0x01;
    _CH=15;
    _CL=15;
    geninterrupt(0x10);
    }
    
    
    
    showcursor()
    {
    _AH=0x01;
    _CH=14;
    _CL=15;
    geninterrupt(0x10);
    }
    
    print_fileinfo(int row,char attr,struct ffblk *f)
    {
    char atb[5];
    unsigned char cx;
    if(f->ff_name[0]=='\0')
     return 0;
    cx=(f->ff_reserved[0]=='\x1')?175:32;
    if(cx==175 && attr!=HLTXT)
      attr=SELTXT;
    gotoxy(1,row);
    textattr(NORMTXT);
    cprintf("³");
    textattr(attr);
    cprintf("%c%-19s",cx,f->ff_name);
    textattr(NORMTXT);
    cprintf("³");
    textattr(attr);
    cprintf("%02d-%02d-%02d %02d:%02d",f->ff_fdate&31,(f->ff_fdate>>5)&15,((f->ff_fdate>>9)+80)%100,(f->ff_ftime>>11)&31,(f->ff_ftime>>5)&63);
    textattr(NORMTXT);
    cprintf("³");
    textattr(attr);
      if(f->ff_attrib & FA_DIREC)
       cprintf("%10s","<Dir>");
      else if(f->ff_attrib & FA_LABEL)
       cprintf("%10s","<Drive>");
      else
       cprintf("%10ld",f->ff_fsize);
      if(f->ff_attrib & FA_RDONLY)
    	atb[0]='R';
      else
       atb[0]='-';
      if(f->ff_attrib & FA_HIDDEN)
    	atb[1]='H';
      else
       atb[1]='-';
      if(f->ff_attrib & FA_SYSTEM)
    	atb[2]='S';
      else
       atb[2]='-';
      if(f->ff_attrib & FA_ARCH)
    	atb[3]='A';
      else
       atb[3]='-';
      atb[4]=0;
    
      textattr(NORMTXT);
      cprintf("³");
      textattr(attr);
      cprintf("%6s",atb);
      textattr(NORMTXT);
      cprintf("³");
      return 1;
    }
    
    
    showtitle()
    {
    window(1,1,80,24);
    textattr(TITLETXT);
    gotoxy(1,1);
    clreol();
    cprintf("³%-20s³%-14s³%-10s³%-6s³ Directory Information","Name","Date","Size","Attrib");
    
    
    if(sorttype!=0)
     {
     textattr(TITLEHL);
     switch(sorttype)
     {
     case 1:
      gotoxy(2,1);
      cprintf("%-20s","Name");
      break;
     case 2:
      gotoxy(2,1);
      cprintf("%-20s","Name (.)");
      break;
     case 4:
      gotoxy(23,1);
      cprintf("%-14s","Date");
      break;
     case 3:
      gotoxy(38,1);
      cprintf("%-10s","Size");
      break;
     }
     }
    window(1,2,80,24);
    }
    
    
    showmsg(char *msg)
    {
     window(1,24,79,24);
     textattr(MSGTXT);
     clrscr();
     while(*msg)
      {
      if(*msg>=' ' && *msg<='~')
      cprintf("%c",*msg++);
      else
      msg++;
      }
      sound(SND);
      delay(100);
      nosound();
      getch();
      window(1,2,80,24);
    }
    
    
    showdirinfo(unsigned no)
    {
    unsigned i;
    long sz=0;
    char buf[400],*ptr,stype[][7]={"Unsort","Name","Ext","Size","Date"};
    FILLBOX(56,1,80,10,NORMTXT>>4);
    DRAWBOX(56,1,80,10,1,NORMTXT>>4,NORMTXT&15);
    window(57,3,79,10);
    ptr=strrchr(getcwd(buf,400),'\\');
    ptr++;
    gotoxy(1,1);
    cprintf("Drive   : %c",buf[0]);
    gotoxy(1,2);
    cprintf("Dir     : %s",(*ptr=='\0')?"\\":ptr);
    gotoxy(1,3);
    cprintf("Pattern : %s",pattern);
    gotoxy(1,4);
    cprintf("Sort by : %s",stype[sorttype]);
    gotoxy(1,5);
    cprintf("Files   : %u",no+1);
    for(i=0;i<=no;i++)
     {
     sz=sz+(flist[i].ff_fsize/1024L);
     }
    gotoxy(1,6);
    cprintf("Net Size: %uK",sz);
    gotoxy(1,7);
    cprintf("Memory  : %uK",biosmemory());
    gotoxy(1,8);
    cprintf("Free    : %luK",farcoreleft()/1024);
    window(1,2,80,24);
    }
    
    showhelp()
    {
    /*gotoxy(1,22);
    textattr(HELPTXT);
    clreol();
    cprintf("F1,F2,F3,F4-Sort ³ F5-Reverse ³ F6-Open ³ F7-Hidden ³ F11-Drive ³ F12-B/W");
    gotoxy(56,12);*/
    FILLBOX(56,11,80,21,NORMTXT>>4);
    DRAWBOX(56,11,80,21,1,NORMTXT>>4,NORMTXT&15);
    textattr(TITLETXT);
    /*gotoxy(57,12);
    cprintf("%9s Menu%9s","","");
    textattr(NORMTXT);
    gotoxy(57,15);
    cprintf(" Press F10 to Activate");
    gotoxy(67,16);
    cprintf("Menu");*/
    }
    
    int showfiles()
    {
    int ans,psort=0;
    unsigned  cnt=0,i,start,ch,lno=0,pstart=1,plno=1,selfiles=0,tu;
    unsigned char fattr=FA_DIREC|FA_LABEL;
    struct ffblk f;
    LOADLIST:
    textattr(DEFTXT);
    start=0;
    pstart=1;
    /*if(flist!=NULL)
     free(flist);*/
    ans=findfirst(pattern,&f,fattr);
    
    while(!ans)
     {
     cnt++;
     ans=findnext(&f);
     }
    flist=(struct ffblk *)realloc(flist,sizeof(struct ffblk )*(cnt+1));
    if(flist==NULL)
     return 0;
    memset(flist,0,sizeof(struct ffblk )*(cnt+1));
    ans=findfirst(pattern,&f,fattr);
    cnt=0;
    while(!ans)
     {
     if(strcmp(f.ff_name,".")!=0)
     {
     memcpy(&flist[cnt],&f,sizeof(f));
     flist[cnt].ff_reserved[0]=0;
     cnt++;
     }
     ans=findnext(&f);
     }
     if(cnt==0)
      {
      showmsg("No Files Found!!!");
      strcpy(pattern,"*.*");
      goto LOADLIST;
      }
     cnt--;
     if(start>cnt-MaxLines-1)
     start=0;
     if(lno>MaxLines || lno>cnt)
     lno=0;
     showtitle();
     psort=!sorttype;
     shortlist(cnt);
    while(1)
    {
    if(start>cnt-MaxLines+1)
     start=0;
    if(lno>MaxLines || lno>cnt)
     lno=0;
    if(sorttype!=psort)
     {
     showtitle();
     showdirinfo(cnt);
     showhelp();
     psort=sorttype;
     }
     print_fileinfo(lno+1,HLTXT,&flist[lno+start]);
     selfiles=0;
     for(i=start;i<start+MaxLines && start!=pstart;i++)
      {
      if(i>cnt)
       break;
      if(flist[i].ff_reserved[0]=='\x1')
       selfiles++;
      if(i-start!=lno)
      print_fileinfo(i-start+1,NORMTXT,&flist[i]);
      }
    
      textattr(NORMTXT);
      for(;i<start+MaxLines && start!=pstart;i++)
       {
       gotoxy(1,i-start+1);
       cprintf("³%-20s³%-14s³%-10s³%-6s³","","","","");
       }
      pstart=start;
      gotoxy(1,MaxLines+1);
      textattr(NORMTXT);
      if(start+MaxLines<cnt-1)
       cprintf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄ More ÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÙ");
      else
       cprintf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÙ");
    
      plno=lno;
      /*print_fileinfo(lno+1,HLTXT,&flist[lno+start]);*/
      gotoxy(1,23);
      textattr(DEFTXT);
      clreol();
      getcwd(temp,80);
      if(strlen(temp)==3)
       cprintf("%s%s",temp,flist[start+lno].ff_name);
      else
       cprintf("%s\\%s",temp,flist[start+lno].ff_name);
      showinfo();
      ch=getch();
    
      if(ch==0)
    	ch=getch();
      else
       ch=tolower(ch);
      textattr(DEFTXT);
      switch(ch)
      {                                                 /*Space Bar*/
      case 32:
    		  flist[start+lno].ff_reserved[0]=!flist[start+lno].ff_reserved[0];
              print_fileinfo(lno+1,HLTXT,&flist[lno+start]);
    		  break;
      case 80:											/*Down Arrow*/
    		  if(lno<MaxLines-1) lno++;
    		  else if(start<cnt-MaxLines+1)
    		  start++; break;
      case 72:                  						/*Up Arrow*/
    		  if(lno>0) lno--;
    		  else if(start>0)
    		  start--;break;
      case 81:                                          /*Page Down*/
    		  if((int)start+MaxLines-1<(int)cnt-MaxLines-1)
    		  {
    		  start=start+MaxLines-1;
    		  }
    		  else
    		  {
    		  if(start==cnt-MaxLines+1 || start==0)
    		   {
    		   sound(SND);
    		   delay(100);
    		   nosound();
    		   }
    		  if(cnt>MaxLines)
    		   start=cnt-MaxLines+1;
    		  else
    		   start=0;
    		  }
    		  break;
      case 82:										/*Insert*/
    		  close(creat(tmpnam(NULL),S_IFREG|S_IWRITE));
    		  goto LOADLIST;
      case 73:                              		/* Page Up*/
    		  if((int)start-MaxLines+1>1)
    		  {
    		  start=start-(MaxLines+1);
    		  }
    		  else
    		  {
    		  if(start==0)
    		   lno=0;
    		  start=0;
    		  }
    		  break;
    
      case 8:										/*BkSp - Key*/
    		  if(!chdir(".."))
    		  goto LOADLIST;
    		  else
    		  NOISE();
    		  break;
      case 13:											/*Enter or Return Key*/
      case 10:
    		  if(flist[lno+start].ff_attrib&FA_DIREC)
    			{
    			chdir(flist[lno+start].ff_name);
    			psort=!sorttype;
    			goto LOADLIST;
    			}
    		  else
    		   {
    		   char ext[4];
    		   strcpy(ext,strrchr(flist[lno+start].ff_name,'.'));
    		   if(stricmp(ext,".exe")==0 || stricmp(ext,".bat")==0 || stricmp(ext,".com")==0)
    			 {
    			 textattr(DEFTXT);
    			 clrscr();
    			 window(1,1,80,24);
    			 textattr(7);
    			 clrscr();
    			 system(flist[lno+start].ff_name);
    			 gotoxy(1,24);
    			 hidecursor();
    			 showmsg("Press any key...");
    			 textattr(DEFTXT);
    			 psort=!sorttype;
    			 clrscr();
    			 goto LOADLIST;
    			 }
    		   }
    		  break;
    
      case 83:										/*Delele Key*/
    		selfiles=0;
    		for(tu=0;tu<=cnt;tu++)
    		 if(flist[tu].ff_reserved[0]=='\x1')
    		  selfiles++;
    		if(selfiles>0)
    		  {
    		  int i;
    		  for(i=0;i<=cnt;i++)
    		  {
    		  if(flist[i].ff_reserved[0]=='\x0')
    		   continue;
              _chmod(flist[i].ff_name,1,0);
    		   if(flist[i].ff_attrib&FA_DIREC)
    		   {
    
    			if(rmdir(flist[i].ff_name))
    			{
    			 gotoxy(1,23);
    			 showmsg(strerror(errno));
    			}
    		   }
    		   else
    			{
    			 if(unlink(flist[i].ff_name))
    			  showmsg(strerror(errno));
    			}
    		   }
    			goto LOADLIST;
    		  }
    		else
    		 if(flist[lno+start].ff_attrib&FA_DIREC)
    		  {
    		  if(rmdir(flist[lno+start].ff_name))
    		  {
    		   gotoxy(1,23);
    		   showmsg(strerror(errno));
    		  }
    		  }
    		 else
    		  {
    		  _chmod(flist[lno+start].ff_name,1,0);
    		  unlink(flist[lno+start].ff_name);
    		  }
    		 goto LOADLIST;
      case 71:                                      /*Home Key*/
    		start=0;
    		lno=0;
    		break;
      case 79:										/*End Key*/
    		if(cnt>MaxLines)
    		start=cnt-MaxLines+1;
    		lno=MaxLines-1;
    		break;
    												/* Function Keys F1-F12 */
      case 59:
    			shortbyname(cnt);
    			pstart=!start;
    			break;
      case 60:
    			shortbyext(cnt);
    			pstart=!start;
    			break;
      case 61:
    			shortbydate(cnt);
    			pstart=!start;
    			break;
      case 62:
    			shortbysize(cnt);
    			pstart=!start;
    			break;
      case 63:
    			reverselist(cnt);
    			pstart=!start;
    			break;
      case 64:
    			window(1,1,80,24);
    			textattr(7);
    			clrscr();
    			strcpy(temp,"Edit ");
    			strcat(temp,flist[start+lno].ff_name);
    			system(temp);
    			goto LOADLIST;
      case 65:
    		   if(fattr==(FA_DIREC|FA_LABEL))
    			 fattr=FA_DIREC|FA_SYSTEM|FA_HIDDEN|FA_LABEL;
    		   else
    			 fattr=FA_DIREC|FA_LABEL;
    		   goto LOADLIST;
      case 66:
    		   change_pattern();
    		   psort=!sorttype;
    		   pstart=!start;
    		   goto LOADLIST;
      case 67:
    		   window(1,1,80,25);
    		   textattr(7);
    		   clrscr();
    		   showcursor();
    		   printf("Type EXIT to Return Directory Browser...\n");
    		   if(system(""))
    			showmsg("Error Occured!!!");
    		   hidecursor();
    		   goto LOADLIST;
      case 68:
    		  print_fileinfo(lno+1,NORMTXT,&flist[lno+start]);
    		  ActivateMenu();
    		  goto LOADLIST;
      case 133:													/*F11*/
    			if(changedrive())
    				{
    				pstart=!start;
    				goto LOADLIST;
    				}
    			else
    				{
    				pstart=!start;
    				psort=!sorttype;
    				}
    			break;                                          /*F12*/
      case 134:
    			switchcolors();
    			pstart=!start;
    			psort=!sorttype;
    			break;
    												/*Shift + Fn Key*/
      case 89:										/* Shift F6 */
    		   window(1,1,80,25);
    		   textattr((1<<4)|15);
    		   clrscr();
    		   show_file(flist[start+lno].ff_name);
    		   showmsg("Press Any Key...");
    		   goto LOADLIST;
    
      case 135:                                            /*Shift + F11*/
    		  stopinfo();
    		  gotoxy(1,23);
    		  textattr(7);
    		  clreol();
    		  cprintf("Enter Path:");
    		  scanf("%s",temp);
    		  clrscr();
    		  if(strchr(temp,':')!=NULL)
    		  setdisk(toupper(temp[0])-65);
    		  chdir(temp);
    		  goto LOADLIST;
    														/*CTRL+Fn*/
      case 94:												/*CTRL+F1*/
    		   ShowKeyList();
    		   goto LOADLIST;
    
      case 27:                                              /*Esc*/
    			 free(flist);
    			 return 0;
      default:
    		 RECHECK:
    		 if((ch>=32 && ch<=64) || (ch>=91 && ch<=126))
    		  {
    		  int sno;
    		  sno=0;
    		  for(i=start+lno+1;i<=cnt;i++)
    		   {
    			if(toupper(flist[i].ff_name[0])==toupper(ch))
    				{
    				if((int)i-MaxLines+1>0)
    					{
    					start=i-MaxLines+1;
    					lno=MaxLines-1;
    					}
    				else
    					{
    					lno=i;
    					}
    				pstart=!start;
    				sno=1;
    				break;
    			   }
    		   }/*End of For*/
    		 if(!sno && (int)lno!=-1)
    		  {
    		  lno=-1;
    		  start=0;
    		  plno=lno;
    		  goto RECHECK;
    		  }
    		 else if((int)lno==-1)
    		  lno=plno;
    		 }
    		 break;
      }/*end of Switch*/
      if(lno+start > cnt)
       lno=cnt-start;
      if(lno!=plno)
       print_fileinfo(plno+1,NORMTXT,&flist[plno+start]);
    
    }/*end of while(1)*/
    }
    
    shortbyname(unsigned no)
    {
    unsigned i,j;
    struct ffblk fl;
    for(i=0;i<no;i++)
     for(j=i+1;j<=no;j++)
      {
      if(stricmp(flist[i].ff_name,flist[j].ff_name)>0 && !(flist[i].ff_attrib & (FA_DIREC|FA_LABEL)))
    	{
    	memcpy(&fl,&flist[i],sizeof(fl));
    	memcpy(&flist[i],&flist[j],sizeof(fl));
    	memcpy(&flist[j],&fl,sizeof(fl));
    	}
      }
    sorttype=1;
    return 1;
    }
    
    shortbyext(unsigned no)
    {
    unsigned i,j;
    struct ffblk fl;
    for(i=0;i<no;i++)
     for(j=i+1;j<=no;j++)
      {
      if(stricmp(strrchr(flist[i].ff_name,'.'),strrchr(flist[j].ff_name,'.'))>0 && strcmp(flist[i].ff_name,"..")!=0 && !(flist[i].ff_attrib & (FA_DIREC|FA_LABEL)))
    	{
    	memcpy(&fl,&flist[i],sizeof(fl));
    	memcpy(&flist[i],&flist[j],sizeof(fl));
    	memcpy(&flist[j],&fl,sizeof(fl));
    	}
      }
    sorttype=2;
    return 1;
    }
    
    
    shortbysize(unsigned no)
    {
    unsigned i,j;
    struct ffblk fl;
    for(i=0;i<no;i++)
     for(j=i+1;j<=no;j++)
      {
      if(flist[i].ff_fsize>flist[j].ff_fsize && strcmp(flist[i].ff_name,"..")!=0 && !(flist[i].ff_attrib & (FA_DIREC|FA_LABEL)))
    	{
    	memcpy(&fl,&flist[i],sizeof(fl));
    	memcpy(&flist[i],&flist[j],sizeof(fl));
    	memcpy(&flist[j],&fl,sizeof(fl));
    	}
      }
    sorttype=3;
    return 1;
    }
    
    
    
    shortbydate(unsigned no)
    {
    unsigned i,j;
    struct ffblk fl;
    for(i=0;i<no;i++)
     for(j=i+1;j<=no;j++)
      {
      if(flist[i].ff_fdate>=flist[j].ff_fdate && strcmp(flist[i].ff_name,"..")!=0 && !(flist[i].ff_attrib & (FA_DIREC|FA_LABEL)))
    	{
    	if(flist[i].ff_fdate==flist[j].ff_fdate)
    	 if(flist[i].ff_ftime<flist[j].ff_ftime)
    	  continue;
    	memcpy(&fl,&flist[i],sizeof(fl));
    	memcpy(&flist[i],&flist[j],sizeof(fl));
    	memcpy(&flist[j],&fl,sizeof(fl));
    	}
      }
    sorttype=4;
    return 1;
    }
    
    
    reverselist(unsigned no)
    {
    struct ffblk fl;
    unsigned i,j;
    for(j=no,i=0;i<=no/2;i++,j--)
      {
       memcpy(&fl,&flist[i],sizeof(fl));
       memcpy(&flist[i],&flist[j],sizeof(fl));
       memcpy(&flist[j],&fl,sizeof(fl));
      }
    return 1;
    }
    
    changedrive()
    {
    char ch;
    gotoxy(67,2);
    cprintf(" \b");
    fflush(stdin);
    ch=getche();
    ch=toupper(ch);
    window(1,1,80,24);
    textattr(7);
    clrscr();
    setdisk(ch-65);
    fflush(stdin);
    return 1;
    }
    
    stopinfo()
    {
    window(1,1,80,25);
    gotoxy(1,25);
    textattr(SYSTXT);
    clreol();
    cprintf("File Manager 1.0 ³ Done by : Jeyakumar M S ³ Year : 2003   ");
    gotoxy(1,23);
    textattr(HELPTXT);
    clreol();
    window(1,2,80,24);
    }
    
    showinfo()
    {
    struct time t;
    struct date d;
    static unsigned char pt,ph,ilx;
    static nx,pos=79;
    char ch;
    char skeys[]="F1-Sort by Name ³ F2-Sort by Ext ³ F3-Sort by Date ³ F4-Sort by Size ³ F5 - Reverse List ³ " \
    			"F6-Open File ³ F7-Show / Hide System and Hidden Files ³ F8-Change Pattern ³ "\
    			"F9-DOS Shell ³ F10-Menu Mode ³ " \
    			"F11-Change Drive ³ F12-Color and B & W Mode Switch ³ Use ENTER key to run .BAT, .EXE, .COM Files ³ " \
    			"BKSP[\x1B]-Previous Directory ³ DEL-Delete File ³ SPACE-Select File Dir. ";
    char *hints[40]={
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ",
    				 "   File Manager 1.0    ",
    				 "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ",
    				 "                       ",
    				 "   Developed by        ",
    				 "   Jeyakumar MS        ",
    				 "   9,Balarengapuram    ",
    				 "   3rd cross street    ",
    				 "   Madurai             ",
    				 "   TamilNadu           ",
    				 "   India               ",
    				 "   Pincode-625009      ",
    				 "                       ",
    				 "  Email:               ",
    				 "  jeyakumarms@yahoo.com",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
                     "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       ",
    				 "                       "};
    while(kbhit())getch();
    textattr(SYSTXT);
    getdate(&d);
    window(1,1,80,25);
    gotoxy(1,25);
    cprintf("File Manager 1.0 ³ Done by : Jeyakumar M S ³ Year : 2003   ");
    do
     {
      gettime(&t);
      if(t.ti_sec!=pt)
       {
    	gotoxy(60,25);
        textattr(SYSTXT);
    	clreol();
    	cprintf("³%02d-%02d-%04d %02d:%02d:%02d",d.da_day,d.da_mon,d.da_year,t.ti_hour,t.ti_min,t.ti_sec);
    	pt=t.ti_sec;
    
    	/*gotoxy(56,12);
    	FILLBOX(56,11,80,21,NORMTXT>>4);
    	DRAWBOX(56,11,80,21,1,NORMTXT>>4,NORMTXT&15);*/
    	BOXMENU(hints,57,12,1,ilx,ilx+8,NORMTXT&15,NORMTXT>>4);
    	ilx=(ilx+1)%29;
       }
      if(abs(t.ti_hund-ph)>15)
       {
    	textattr(HELPTXT);
    	gotoxy(1,23);
    	clreol();
    	gotoxy(1+pos,23);
    	ch=skeys[nx+79-pos];
    	skeys[nx+79-pos]=0;
    	cprintf("%s",&skeys[nx]);
    	skeys[nx+79-pos]=ch;
    	if(nx==0)
    	 {
    	 pos=pos-1;
    	 if(pos==0)
    	  nx=2;
    	 }
    	else
    	 {
    	 nx=(nx+1) % strlen(skeys);
    	 if(nx==0)
    	  pos=79;
    	 }
    
    	ph=t.ti_hund;
       }
     }while(!kbhit());
    window(1,2,80,24);
    }
    
    
    switchcolors()
    {
    static colset;
    static pset[8];
    if(colset==0)
    {
    pset[0]=TITLETXT;
    pset[1]=TITLEHL;
    pset[2]=NORMTXT;
    pset[3]=HLTXT;
    pset[4]=SYSTXT;
    pset[5]=MSGTXT;
    pset[6]=HELPTXT;
    pset[7]=SELTXT;
    TITLETXT=7<<4;
    TITLEHL=(7<<4)|15;
    NORMTXT=7;
    HLTXT=7<<4;
    SYSTXT=(7<<4)|15;
    MSGTXT=7<<4;
    HELPTXT=7<<4;
    SELTXT=15;
    colset=1;
    }
    else
     {
     TITLETXT=pset[0];
     TITLEHL=pset[1];
     NORMTXT=pset[2];
     HLTXT=pset[3];
     SYSTXT=pset[4];
     MSGTXT=pset[5];
     HELPTXT=pset[6];
     SELTXT=pset[7];
     colset=0;
     }
    }
    
    shortlist(unsigned no)
    {
    switch(sorttype)
    {
    case 1:
    		shortbyname(no);break;
    case 2:
    		shortbyext(no);break;
    case 3:
    		shortbydate(no);break;
    case 4:
    		shortbysize(no);break;
    }
    }
    
    ShowKeyList()
    {
    char file[]="Key.txt",*tmp;
    tmp=(char *)malloc(strlen(apath)+strlen(file)+1);
    strcpy(tmp,apath);
    strcat(tmp,file);
    /*show_file(tmp);*/
    VIEWFILE(tmp);
    }
    
    ActivateMenu()
    {
    int no;
    char *mnu[10]={ " File / Directory      ",\
    				" Edit                  ",\
    				" Settings              ",\
    				" Tools                 ",\
    				" System Information    ",\
    				" Help                  "};
    window(1,1,80,25);
    gotoxy(1,25);
    textattr(SYSTXT);
    clreol();
    cprintf("File Manager 1.0 ³ Done by : Jeyakumar M S ³ Year : 2003   ");
    gotoxy(56,12);
    FILLBOX(56,12,80,22,NORMTXT>>4);
    DRAWBOX(56,12,80,22,1,NORMTXT>>4,NORMTXT&15);
    BOXMENU(mnu,57,14,1,0,6,NORMTXT&15,NORMTXT>>4);
    textattr(TITLETXT);
    gotoxy(57,13);
    cprintf("%9s Menu%9s","","");
    gotoxy(1,23);
    clreol();
    cprintf("Use %c %c Arrows ³ F10/ESC - Exit ³ ENTER - Select", 24,25);
    
    no=ITEMSELC(mnu,6,57,15,1,NORMTXT,HLTXT);
    
    /*TODO:Menu and Options*/
    gotoxy(1,23);
    clreol();
    cprintf("TODO:Menu and Option");
    NOISE();
    getch();
    }
    
    change_pattern()
    {
    char ch;
    gotoxy(67,4);
    window(67,5,79,5);
    textattr(7);
    clrscr();
    cscanf("%s%c",pattern,&ch);
    /*while(kbhit()) getch();*/
    window(1,1,80,24);
    return 1;
    }
    
    show_file(char *name)
    {
    VIEWFILE(name);
    return 1;
    }
    
    
    fpmove(FILE *f,int no)
    {
    long lastp=0;
    int ccnt=0;
    char ch;
    		   do
    		   {
    			 if(fseek(f,-1,SEEK_CUR))
    				{
    				fseek(f,0,SEEK_SET);
    				break;
    				}
    			 ch=getc(f);
    			 ccnt++;
    			 if(ch=='\t')
    			 ccnt+=8;
    			 if(ch==13 || ch==10 || ccnt==80)
    			 {
    			  lastp++;
    			  ccnt=0;
    			  if(ch==13 || ch==10)
    			   if(fseek(f,-1,SEEK_CUR)!=0)
    				return 0;
    			 }
    			 fseek(f,-1,SEEK_CUR);
    			}while(lastp<no);
    			return 1;
    }
    
    

    and this is the header
    TOOL.H


    Code:
     #include<stdio.h>
    #include<ctype.h>
    #include<dos.h>
    
    void MESG(int,int);
    void DRAWBOX(int,int,int,int,int,int,int);
    /*----------------------prjtool.c----------------------*/
    
    typedef struct tagDList
    {
    int len;
    char *buf;
    struct tagDList *next;
    struct tagDList *prev;
    }DList;
    
    
    void FILLBOX(int x1,int y1,int x2,int y2,int cr)
    {
    int i,j;
    textcolor(cr);
    for(i=x1;i<=x2;i++)
    {
    for(j=y1;j<=y2;j++)
    {
    gotoxy(i,j);
    cprintf("%c",219);
    }
    }
    }
    
    void DRAWBOX(x1,y1,x2,y2,lt,bg,fg)
    int x1,x2,y1,y2,lt,bg,fg;
    {
    int i,dd[6];
    textbackground(bg);
    textcolor(fg);
    if(lt!=2)
    {
    dd[0]=196;
    dd[1]=179;
    dd[3]=217;
    dd[2]=218;
    dd[4]=192;
    dd[5]=191;
    }
    else
    {
    dd[1]=186;
    dd[0]=205;
    dd[3]=188;
    dd[2]=201;
    dd[4]=200;
    dd[5]=187;
    }
    
    for(i=x1;i<=x2;i++)
    {
    gotoxy(i,y1);
    cprintf("%c",dd[0]);
    gotoxy(i,y2);
    cprintf("%c",dd[0]);
    }
    for(i=y1;i<=y2;i++)
    {
    gotoxy(x1,i);
    cprintf("%c",dd[1]);
    gotoxy(x2,i);
    cprintf("%c",dd[1]);
    }
    gotoxy(x1,y1);
    cprintf("%c",dd[2]);
    gotoxy(x2,y2);
    cprintf("%c",dd[3]);
    gotoxy(x1,y2);
    cprintf("%c",dd[4]);
    gotoxy(x2,y1);
    cprintf("%c",dd[5]);
    }
    
    
    ERR()
    {
    MESG(9,0);
    getch();
    clrscr();
    return 1;
    }
    
    SMHORZ(char *arr[10],int x,int y,int dis,int no,int tc,int tb)
    {
    int i,bx=0;
    textcolor(tc);
    textbackground(tb);
    for(i=0;i<no;i++)
    {
    gotoxy(x+bx,y);
    cprintf("%s",arr[i]);
    bx+=dis;
    }
    return 1;
    }
    SMVER(char *arr[20],int y,int dis,int from,int to,int tc,int tb)
    {
    int i;
    textcolor(tc);
    textbackground(tb);
    for(i=from;i<to;i++)
    {
    gotoxy(20-strlen(arr[i]),y+=dis);
    cprintf("%s",arr[i]);
    }
    return 1;
    }
    
    
    BOXMENU(char *arr[],int x,int y,int dis,int from,int to,int tc,int tb)
    {
    int i;
    textcolor(tc);
    textbackground(tb);
    for(i=from;i<to;i++)
    {
    gotoxy(x,y+=dis);
    cprintf("%s",arr[i]);
    }
    return 1;
    }
    
    ITEMSELC(char *gr[10],int max,int x,int y,int space,char attr,char hattr)
    {
    int hit=0,co=1;
    textattr(hattr);
    gotoxy(x,y);
    cprintf("%s",gr[co-1]);
    while(hit!=13)
    {
    hit=toascii(getch());
    /*textcolor(15);
    textbackground(1);*/
    textattr(attr);
    gotoxy(x,y);
    cprintf("%s",gr[co-1]);
    /*textcolor(0);
    textbackground(15);*/
    textattr(hattr);
    switch(hit)
    	{
    	case 72:if(co==1)
    			{
    			co=max;
    			y=y+space*(max-1);
    			gotoxy(x,y);
    			cprintf("%s",gr[co-1]);
    			}
    			else
    			{
    			co-=1;
    			y-=space;
    			gotoxy(x,y);
    			cprintf("%s",gr[co-1]);
    			}
    			break;
    	case 80:if(co==max)
    			{
    			co=1;
    			y=y-space*(max-1);
    			gotoxy(x,y);
    			cprintf("%s",gr[co-1]);
    			}
    			else
    			{
    			co+=1;
    			y+=space;
    			gotoxy(x,y);
    			cprintf("%s",gr[co-1]);
    			}
    			break;
    	case 68:
    		return -1;
    	case 27:co=max;
    		return(co);
    	default:gotoxy(x,y);
    		cprintf("%s",gr[co-1]);
    		break;
    	  }
    	}
    	return(co);
    }
    
    NOTFOUND()
    {
    MESG(7,0);
    getch();
    return 1;
    }
    FOUND(int no)
    {
    MESG(6,no);
    getch();
    return 1;
    }
    void DELT(int no)
    {
    DRAWBOX(15,10,40,12,2,0,6);
    gotoxy(18,11);
    textcolor(10);
    cprintf("%d Recored(s) Deleted.",no);
    getch();
    }
    
    void MESG(int i,int no)
    {
    /*TODO:Show  Message Window*/
    }
    
    
    
    NOISE()
    {
    sound(600);
    delay(100);
    nosound();
    }
    
    SCROLL_DOWN()
    {
    _AH=0x07;
    _AL=1;
    _BH=7;
    _CH=0;
    _CL=0;
    _DH=24;
    _DL=79;
    geninterrupt(0x10);
    }
    
    SCROLL_UP()
    {
    _AH=0x06;
    _AL=1;
    _BH=7;
    _CH=0;
    _CL=0;
    _DH=24;
    _DL=79;
    geninterrupt(0x10);
    }
    
    VIEWFILE(char *name)
    {
    FILE *f;
    char str[80],ch,x=0,y=0;
    DList *d;
    f=fopen(name,"r");
    if(f==NULL)
     return 0;
    d=(DList*)malloc(sizeof(DList));
    d->buf=(char *)malloc(80);
    if(d==NULL)
     return 0;
    d->next=NULL;
    d->prev=NULL;
    window(1,1,80,25);
    sprintf(d->buf,"*** File : %s ***",name);
    showcursor();
    while(!feof(f))
      {
      fgets(str,79,f);
      str[strlen(str)-1]='\0';
      d->next=(DList*)malloc(sizeof(DList));
      if(d->next==NULL)
       break;
      d->next->prev=d;
      d->next->next=NULL;
      d=d->next;
      d->len=strlen(str);
      d->buf=(char*)malloc(d->len+1);
      if(d->buf==NULL)
       break;
      strcpy(d->buf,str);
      }
      d=d->prev;
      d->next=NULL;
    while(d->prev!=NULL)
     d=d->prev;
    for(y=1;y<=25;y++)
    SCROLL_UP();
    textattr(15);
    for(y=1;y<25 && d!=NULL;y++)
     {
     gotoxy(1,y);
     printf("%s\r",d->buf);
     d=d->next;
     }
     y--;
     d=d->prev;
    do
    {
    ch=getch();
    if(ch==0)
    ch=getch();
    switch(ch)
     {
     case 72:
    		if(y>1)
    		 {
    			d=d->prev;
    			y--;
    		 }
    		else if(d->prev!=NULL)
    		 {
    			d=d->prev;
    			SCROLL_DOWN();
    		 }
    		else
    			NOISE();
    		break;
     case 80:
    		if(y<25 && d->next!=NULL)
    		 {
    			d=d->next;
    			y++;
    		 }
    		else if(d->next!=NULL)
    		 {
    			d=d->next;
    			SCROLL_UP();
    		 }
    		else
    			NOISE();
    		break;
     }
     gotoxy(1,y);
     printf("%s\r",d->buf);
    }while(ch!=27);
    fclose(f);
    hidecursor();
    return 1;
    }


    When i compiled it, it shows following errors

    •Linking DR.EXE:
    Linker Error: Undefined symbol _DRAWBOX in module DR.C
    Linker Error: Undefined symbol _FILLBOX in module DR.C
    Linker Error: Undefined symbol _NOISE in module DR.C
    Linker Error: Undefined symbol _BOXMENU in module DR.C
    Linker Error: Undefined symbol _VIEWFILE in module DR.C
    Linker Error: Undefined symbol _ITEMSELC in module DR.C


    Please tell me how to solve it
     
  2. pranav_535

    pranav_535 New Member

    Sorry This Is Not An Error! Please Delete This Thread
     
  3. shabbir

    shabbir Administrator Staff Member

    Thread closed.
     
Thread Status:
Not open for further replies.

Share This Page