Kako da pokrenem program?????Šta napisati u komandnoj liniji?
#include <dir.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
void psplit (char *path, char *name)
{
int pl,i,wild;
struct ffblk *dff;
dff = 0x00ff; /* inicijalizacija pointera */
*name = 0;
wild = 0;
i = pl = strlen (path) - 1;
while (i >= 0 && path != '\\' && path != ':')
{
if (path == '*' || path =='\?') wild = 1;
--i;
}
if (i == pl) return;
if (!wild)
{
if (!findfirst(path,dff,FA_DIREC))
{
strcat(*path,'\\');
return;
}
}
++i;
strcpy (name, path + i);
path = 0;
} /* end psplit */
char *pshort (char *path)
{
int i,j,c;
char *p;
p = path;
i = j = path[1] == ':' ? p += 2, 1 : -1;
while (c = *p++)
if (c == '\\' && *p == '.')
{
++p;
if (*p == '.')
{
++p;
while (i > j && (c = path[i--]) != '\\' && c != ':');
}
} else
path[++i] = c;
path[++i] = 0;
return (path);
} /* end pshort */
char *preal (char *path)
{
int cd,pd,d;
d = strlen (path);
if (d && path[d-1] == '\\') path[d-1] = 0;
cd = getdisk ();
if (path[1] == ':')
pd = path[0] & 0xf;
else
pd = cd;
if (cd != pd)
setdisk (pd);
/* chdir (path); */
getcwd (path,64);
if (cd != pd)
setdisk (cd);
return (path);
}
main (int argc, char *argv[]) /* procitaj komandnu liniju */
{
char path [80];
char name [80];
if (argc > 1)
{
strcpy (path, argv[1]); /* sa cmd_linije prepisi u path */
psplit (path, name);
printf ("Path='%s'\nName='%s'\n",path,name);
printf ("Path='%s'\n",pshort(path));
printf ("Path='%s'\n",preal(path));
}
else
printf ("Unesi path na komandnu liniju\nZbogom!\n");
}
#include <dir.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
void psplit (char *path, char *name)
{
int pl,i,wild;
struct ffblk *dff;
dff = 0x00ff; /* inicijalizacija pointera */
*name = 0;
wild = 0;
i = pl = strlen (path) - 1;
while (i >= 0 && path != '\\' && path != ':')
{
if (path == '*' || path =='\?') wild = 1;
--i;
}
if (i == pl) return;
if (!wild)
{
if (!findfirst(path,dff,FA_DIREC))
{
strcat(*path,'\\');
return;
}
}
++i;
strcpy (name, path + i);
path = 0;
} /* end psplit */
char *pshort (char *path)
{
int i,j,c;
char *p;
p = path;
i = j = path[1] == ':' ? p += 2, 1 : -1;
while (c = *p++)
if (c == '\\' && *p == '.')
{
++p;
if (*p == '.')
{
++p;
while (i > j && (c = path[i--]) != '\\' && c != ':');
}
} else
path[++i] = c;
path[++i] = 0;
return (path);
} /* end pshort */
char *preal (char *path)
{
int cd,pd,d;
d = strlen (path);
if (d && path[d-1] == '\\') path[d-1] = 0;
cd = getdisk ();
if (path[1] == ':')
pd = path[0] & 0xf;
else
pd = cd;
if (cd != pd)
setdisk (pd);
/* chdir (path); */
getcwd (path,64);
if (cd != pd)
setdisk (cd);
return (path);
}
main (int argc, char *argv[]) /* procitaj komandnu liniju */
{
char path [80];
char name [80];
if (argc > 1)
{
strcpy (path, argv[1]); /* sa cmd_linije prepisi u path */
psplit (path, name);
printf ("Path='%s'\nName='%s'\n",path,name);
printf ("Path='%s'\n",pshort(path));
printf ("Path='%s'\n",preal(path));
}
else
printf ("Unesi path na komandnu liniju\nZbogom!\n");
}