• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

IFileSystem.GetBaseName Method

Started by José Roca, July 14, 2008, 02:49:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example illustrates the use of the GetBaseName method.

JScript


function GetTheBaseName(filespec)
{
   var fso, s = "";
   fso = new ActiveXObject("Scripting.FileSystemObject");
   s += fso.GetBaseName(filespec);
   return(s);
}


VBScript


Function GetTheBaseName(filespec)
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   GetTheBaseName = fso.GetBaseName(filespec)
End Function


PowerBASIC


FUNCTION GetTheBaseName (BYVAL strFileSpec AS STRING) AS STRING

   LOCAL fso AS IFileSystem

   fso = NEWCOM ("Scripting.FileSystemObject")
   FUNCTION = ACODE$(fso.GetBaseName(UCODE$(strFileSpec)))
 
END FUNCTION