Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Long filenames?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Titre:
Divers
Thread ID:
00967429
Message ID:
00967434
Vues:
8
>I would like to output out of Fox2.x DOS long filenames. Is this possible? I have tried a bunch of combinations, but nothing worked. I tried x="Thisisalongfilename.txt" and then &x, but nothing. Any ideas?

Hi Dale,

FPD doesn't support long file names. To get around it, you can generate on the fly DOS .BAT file to check for file existence, copy short name to long and vise vers, e.t.c. and run it using RUN command. For example,
*  Program  _FILELN.PRG
*  Purpose  Check for existense of the file with long name
PARAMETERS tcFileName

PRIVATE lcTempName, lcBatName, lcNL, lcBatBody
PRIVATE lcFileName, lcDosCmd, llFound, lcBuffer
lcFileName = UPPER(ALLTRIM(tcFileName))
* Get temp file names for a batch file and a reponse file
lcBatName  = _tmpfile(_tmpdir(), "bat")
lcTempName = _tmpfile(_tmpdir(), "tmp")
lcNL = CHR(13) + CHR(10)
* Create and write to disk the batch file
lcBatBody = ""
lcBatBody = lcBatBody  + "@ECHO OFF" + lcNL
lcBatBody = lcBatBody  + "IF NOT EXIST %1 GOTO NotFound" + lcNL
lcBatBody = lcBatBody  + ":Found" + lcNL
lcBatBody = lcBatBody  + "ECHO FileFound > %2" + lcNL
lcBatBody = lcBatBody  + "GOTO Exit" + lcNL
lcBatBody = lcBatBody  + ":NotFound" + lcNL
lcBatBody = lcBatBody  + "ECHO FileNotFound > %2" + lcNL
lcBatBody = lcBatBody  + ":Exit" + lcNL

=_Strfile(lcBatName, lcBatBody)

PRIVATE lcCallProc
lcCallProc = [] 
* Under NT we must use CMD processor instead of COMMAND
IF _Os() = "WNT"
	lcCallProc = [cmd /c ]
ENDIF
lcDosCmd = [RUN ] + lcCallProc + lcBatName + [ ] + lcFileName + [ ] + lcTempName 
&lcDosCmd
* Read the response file
lcBuffer = _filestr(lcTempName)
* Check if 'FileFound' string is in the response file
llFound = ( UPPER("FileFound") $ UPPER(lcBuffer))
* Delete temp. files
ERASE (lcTempName)
ERASE (lcBatName)

RETURN llFound

FUNCTION _OS
DO CASE
CASE OS() = "DOS 05.00"
	m.os = "WNT"	
CASE OS() = "DOS 07.00"
	m.os = "W9X"	
OTHERWISE
	m.os = "DOS"	
ENDCASE
RETURN m.os
The code above uses a few our internal functions which you can easily replace with your own code.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform