#include<stdio.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include <dir.h>
char *current_directory(char *path)
{
strcpy(path, "X:\");
path[0] = 'A' + getdisk();
getcurdir(0, path+3);
return(path);
}
void borra()
{
int x,y;
for(x=0;x<=80;x++)
for(y=0;y<=100;y++)
{ gotoxy(x,y);
printf(" ");
gotoxy(1,1);
}
}
void cambiar()
{ char *ruta;
printf("ingresa la ruta que quieres cambiar: ");
gets(ruta);
chdir (ruta);
}
void dir()
{
struct ffblk ffblk;
int done;
printf("Directory listing of *.*n");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %sn", ffblk.ff_name);
done = findnext(&ffblk);
}
}
void copiar()
{
}
void eliminar()
{
}
void main()
{ char z,* texto;
int q,t,error;
q=0;
while(q==0)
{ char curdir[MAXPATH];
current_directory(curdir);
printf("n%s ", curdir);
error=1;
fflush(stdin);
gets(texto);
printf("");
t=strcmp(texto,"");
if(t==0)
error=0;
t=strcmp(texto,"borra");
if(t==0)
{ borra();
error=0;
}
t=strcmp(texto,"salir");
if(t==0)
{ q++;
error=0;
}
t=strcmp(texto,"ruta");
if(t==0)
{ cambiar();
error=0;
}
t=strcmp(texto,"dir");
if(t==0)
{
dir();
error=0;
}
t=strcmp(texto,"copiar");
if(t==0)
{
copiar();
error=0;
}
t=strcmp(texto,"eliminar");
if(t==0)
{
eliminar();
error=0;
}
if(error==1)
printf("El comando es invalidon");
}
}