Mail Archives: djgpp/2009/03/13/19:30:03
"dos-man 64" <ChairShot AT mail DOT com> wrote in message
news:80df941e-7eb4-4662-8a0b-d8d753a1295d AT e18g2000yqo DOT googlegroups DOT com...
> I've been using this app for quite a few years. I definitely improved
> it last night. However, it's always been my dream to have this
> program work with long filenames.
Well, seems you find a solution before I got to post my reply... In case
it's useful to someone else, here it is.
You could DJGPP's LFN aware functions, or do it using the LFN API directly.
You may want to read through DJGPP's libc.info file for LFN aware and SFN
only functions. IIRC, there is a DJGPP variable that indicates the presence
of an LFN aware environment also. (Seems you found LFN=y...)
This example will indicate whether the host environment supports LFNs or
not.
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <sys/stat.h>
int main(void)
{
int handle;
char SFN[]="eightdot.thr";
char LFN[]="Our_LFN_name_exceeds_83.txt";
/* create a file with an SFN */
_dos_creat(SFN,_A_NORMAL,&handle);
_dos_commit(handle);
_dos_close(handle);
/* attempt to rename with an LFN */
rename(SFN,LFN);
/* did we get our LFN or was our LFN truncated to an 8.3 SFN? */
if(!strcmp(LFN,&strrchr(_truename(LFN,NULL),'\\')[1]))
{
printf("LFN ");
}
else
{
printf("SFN ");
}
printf("%s\n",_truename(LFN,NULL));
remove(LFN);
return(0);
}
Rod Pemberton
- Raw text -