Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Short file names

75 views
Skip to first unread message

Marco

unread,
Jun 24, 2021, 9:42:42 AM6/24/21
to
Hi, there is a function in xharbour returning the short file name in 8.3 format of a long file name?

EXAMPLE:

LF_ToShort("long_file_name.txt") -> "LONGFI~1.TXT"

thanks.

dlzc

unread,
Jun 24, 2021, 3:09:03 PM6/24/21
to
Dear Marco:

On Thursday, June 24, 2021 at 6:42:42 AM UTC-7, Marco wrote:
> Hi, there is a function in xharbour returning the short file name in
> 8.3 format of a long file name?

There is not always a "short file name" generated.

If you get no other answer, you can "RUN" a directory command, pipe the output to a file, and parse the file.
DIR cfilename.typ /X >PARSEME.TXT
date... time... size... short file name... long file name.
Seems to be very columnatic, so should be easy to parse as an SDF or something.

David A. Smith

Jayadev U

unread,
Jun 25, 2021, 12:12:21 AM6/25/21
to
Hi,

Please try with the following:

#pragma begindump

#include <windows.h>
#include "hbapi.h"

HB_FUNC( GETSHORTPATHNAME )
{
char buffer[ MAX_PATH + 1 ] = {0};
GetShortPathName( hb_parcx(1), buffer, MAX_PATH );
hb_retc( buffer );
}

HB_FUNC( GETSHORTFILENAME )
{
char pszReturn[ MAX_PATH ] ;
pszReturn[0]= '\0' ;

GetShortPathName( hb_parcx( 1 ), pszReturn, MAX_PATH - 1 ) ;
hb_retc( pszReturn ) ;
}

#pragma enddump


HTH,

Warm regards,

Jayadev

Marco

unread,
Jul 6, 2021, 5:08:45 AM7/6/21
to
Thanks it works!
0 new messages