Thank you, it should work -----Message d'origine----- De : Matt Trigg [mailto:[EMAIL PROTECTED] Envoyé : jeudi 23 décembre 2004 15:50 À : mapinfo-l@lists.directionsmag.com Objet : RE: MI-L Open File with special extension (MAPBASIC 5)
Christophe, Here is a more complete solution. The function ShortFileName() returns the dos-compatible name for a file whose name is not in the filename.ext format. Matt Define MAX_PATH 260 Type FILETIME dwLowDateTime As Integer dwHighDateTime As Integer End Type Type WIN32_FIND_DATA dwFileAttributes As Integer ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Integer nFileSizeLow As Integer dwReserved0 As Integer dwReserved1 As Integer cFileName As String * MAX_PATH cAlternate As String * 14 End Type Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Integer Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Integer, lpFindFileData As WIN32_FIND_DATA) As Integer Declare Function FindClose Lib "kernel32" Alias "FindClose" (ByVal hFindFile As Integer) As Integer Declare Sub Main Declare Function ShortFileName(ByVal strFileName As String) As String Sub Main Note ShortFileName("c:\test\mylongfilename.extension") End Sub Function ShortFileName(ByVal strFileName As String) As String Dim hFile As Integer Dim intCloseResult As Integer Dim ffResult As WIN32_FIND_DATA hFile = FindFirstFile(strFileName, ffResult) if hFile = 0 Then print "ShortFileName: file not found - " + strFileName else ShortFileName = ffResult.cAlternate end If intCloseResult = FindClose(hFile) End Function -----Original Message----- From: Christophe Brabant [mailto:[EMAIL PROTECTED] Sent: 23 December 2004 10:49 To: MapInfo-L@lists.directionsmag.com Subject: MI-L Open File with special extension (MAPBASIC 5) Hi everyone I would like to open a file sequentially with "Open File <filename> For Input As # 111" but <filename> is like "file.special". Open statment truncates the filename and tries to open "file.spe" instead Any idea ? Thank you --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 14732