X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: Is there some way to convert long filenames to short filenames? Date: Fri, 13 Mar 2009 20:21:57 -0400 Organization: Aioe.org NNTP Server Lines: 56 Message-ID: References: <275d23ac-69e7-4da0-88a0-a807a182477e AT a39g2000yqc DOT googlegroups DOT com> <80df941e-7eb4-4662-8a0b-d8d753a1295d AT e18g2000yqo DOT googlegroups DOT com> NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.aioe.org X-Complaints-To: abuse AT aioe DOT org NNTP-Posting-Date: Sat, 14 Mar 2009 00:19:16 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933 X-Notice: Filtered by postfilter v. 0.7.7 X-Newsreader: Microsoft Outlook Express 6.00.2800.1933 Cancel-Lock: sha1:+L8DdhOEhO7fpyz8MEsshW3BYE4= X-Priority: 3 X-MSMail-Priority: Normal To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "dos-man 64" 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 #include #include #include 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