Message-ID: <39BFA94F.A034873D@teleline.es> Date: Wed, 13 Sep 2000 18:20:31 +0200 From: Mariano Alvarez Fernandez X-Mailer: Mozilla 4.5 [es] (Win95; I) X-Accept-Language: es MIME-Version: 1.0 To: djgpp , seb AT techno-matic DOT dk Subject: Re: How do I get the msdos "long" (x~1.y) filename when I know the real windows long Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Try this: -- lfngsfn.c ---------------- /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ #include #include #include #include #include #include #include char * _lfn_get_short_fname (const char *long_fname, char *short_fname) { __dpmi_regs r; unsigned long tbuf = __tb; short_fname[0] = '\0'; if (_USE_LFN) { dosmemput (long_fname, strlen (long_fname) + 1, tbuf); r.x.ax = 0x7160; r.x.ds = tbuf >> 4; r.x.si = 0; r.x.es = r.x.ds; r.x.di = 260; r.h.cl = 0x01; r.h.ch = 0x00; __dpmi_int (0x21, &r); if ((r.x.flags & 1) == 0 && r.x.ax != 0x7100) { dosmemget (tbuf + 260, 128, short_fname); } } return short_fname; } #ifdef TEST #include int main (int argc, char *argv[]) { char sh[128]; if (argc > 1) printf ("Long: %s\nShort: %s\n", argv[1], _lfn_get_short_fname(argv[1], sh)); return 0; } #endif