delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/30/16:15:19

From: brownsta AT concentric DOT net (Stan Brown)
Newsgroups: comp.os.msdos.djgpp
Subject: LFN support enabled, no LFNs
Date: Mon, 30 Mar 1998 16:12:10 -0500
Organization: Oak Road Systems
Lines: 57
Message-ID: <MPG.f89d4b6336b71de989e41@news.concentric.net>
NNTP-Posting-Host: ts003d05.cle-oh.concentric.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm running a DOS box under Win95. My command shell is 4DOS. I compiled 
my program with GCC 2.01, using this command:
	gcc -o zonk.exe zonk.c
There were no compile or link messages.

(Yes, I've discovered that there's a later version, and I'm in the 
process of downloading it.)

My problem is that, even though the value of _USE_LFN is 1, I'm getting 
back only 8.3-style filenames from _dos_findfirst() and _dos_findnext().
I'm sure I'm doing something obviously wrong, but I just don't see it. 
(Yes, I checked, and the current directory does contain a long filename, 
javascript.zip.)

Can anyone help? (If you post an answer, please send me a copy in email. 
My ISP has been missing some Usenet articles over the past few days.)

Here's the complete program. (The reported file names, sizes, dates, and 
times all look right against a DIR.)

#include <stdio.h>
#include <dos.h>
#include <fcntl.h>

int main(int argc, char **argv) {
    struct find_t f;
    int result;

    printf("_USE_LFN = %d\n", _USE_LFN);
    if ( !_dos_findfirst("*.*", _A_NORMAL, &f) ) {
        while (1) {
            printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
                f.name,
                f.size,
                (f.wr_time >> 11) & 0x1f,
                (f.wr_time >>  5) & 0x3f,
                (f.wr_time & 0x1f) * 2,
                (f.wr_date >>  5) & 0x0f,
                (f.wr_date & 0x1f),
                ((f.wr_date >> 9) & 0x7f) + 1980);
            if ( (result = _dos_findnext(&f)) != 0 ) {
                printf("return value is %d = %04X\n", result, result);
                break;
            }
        }
    }

    return 0;
}


-- 

Stan Brown, Oak Road Systems, Cleveland, Ohio, USA
                      http://www.concentric.net/%7eBrownsta/
Please do not send me mail with a false return address.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019