Yet another question...

 BBS: Inland Empire Archive
Date: 04-09-92 (08:02)             Number: 107
From: MATT HART                    Refer#: NONE
  To: ZACK JONES                    Recvd: NO  
Subj: Yet another question...        Conf: (2) Quik_Bas
 ZJ> What if PathName$ = C:\SOMEDIR\OTHERDIR\FILE.EXT instead of:
 >>  JT> PathName$ = C:\SOMEDIR\OTHERDIR\
 ZJ> and I wanted to remove 'file.ext' and keep everything else?

FUNCTION PathOnly$(File$)
     Found = 0
     FOR i = LEN(File$) TO 1 STEP -1
          IF MID$(File$,i,1) = "\" THEN
               Found = -1
               EXIT FOR
          ENDIF
     NEXT
     IF NOT Found THEN
          PathOnly$ = ""
     ELSE
          PathOnly$ = LEFT$(File$,i)
     ENDIF
END FUNCTION

---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET