Mail Archives: djgpp/1999/01/15/02:20:32
Message-ID: | <000001be4056$488e4100$11a531ce@fresita-one>
|
From: | "Jorge Ivan Meza Martinez" <jimeza AT usa DOT net>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | RE: LFN in Win95? How do I do it?
|
Date: | Thu, 14 Jan 1999 14:43:12 -0500
|
MIME-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook Express 4.72.3110.5
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
Reply-To: | djgpp AT delorie DOT com
|
Hello Eli,
>> printf("8.3 NAME = %s\n", ffblk.name);
>> printf ( "LFN NAME = %s\n", _truename(ffblk.name, NULL) );
>
>Did you actually try this? I think it will only work correctly if your
>current directory is the same as the one listed by _dos_findfirst/next,
>because ffblk.name doesn't include the full path name, only the file name
>part.
yes, you are right; I hadn't tested it with other directories, then
_truename gets (null).
The solution is to append the path to the filename before call _truename.
#include <stdio.h>
#include <dos.h>
#include <dir.h>
struct find_t ffblk;
int main ( int argc, char* argv[] )
{
char path[256];
char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
if ( argc < 2 )
{
printf ( "dir -- dir <what>\n" );
return ( 1 );
}
printf ( "criteria %s\n", argv[1] );
fnsplit(argv[1], d, p, f, e);
if ( _dos_findfirst( argv[1], _A_NORMAL | _A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_VOLID | _A_SUBDIR | _A_ARCH, &ffblk) == 0 )
{
printf("%s\n", ffblk.name);
while ( _dos_findnext(&ffblk) == 0 )
{
sprintf ( path, "%s%s%s", d, p, ffblk.name );
printf ( "8.3 NAME = %s\n", ffblk.name );
printf ( "LFN NAME = %s\n", _truename ( path, NULL ) );
}
}
return ( 0 );
}
But for an unknown reason ( to me ), you have to write the parameter between quots or it doesn't work,
it must be something like dire "c:\windows\command\*.*", writting it without \" it only takes the first file.
talking about dir programs, I got a dobt.
I made this program that write the parameters from command line:
#include <stdio.h>
void main ( int argc, char* argv[] )
{
printf ( "c %i\n", argc );
for ( int i=0; i<argc; i++ )
{
printf ( "%s\n", argv[i] );
}
}
but try it with something like: "kk c:\windows\command\*.*" ( kk is the .exe ) and it prints the directory. why ?
bye,
Jorge Ivan Meza Martinez
jimezam AT armenia DOT multi DOT net DOT co
jimeza AT usa DOT net
jimezam.home.ml.org
["O
Lord, if there is a Lord, save my soul, if I have a soul--", Ernest Renan]
-----Mensaje original-----
De: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Para: Jorge Ivan Meza Martinez <jimeza AT usa DOT net>
CC: djgpp AT delorie DOT com <djgpp AT delorie DOT com>; hoskinst AT cadvision DOT com
<hoskinst AT cadvision DOT com>
Fecha: Miércoles, 13 de Enero de 1999 05:16 p.m.
Asunto: RE: LFN in Win95? How do I do it?
- Raw text -