Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting info from a .dat file 1

Status
Not open for further replies.

mackey333

Technical User
May 10, 2001
563
US
hey everyone, i have compiled an mp3 player from various tutorials and faqs, now i am trying to make a playlist for it...if i have a .dat file set up with paths to files on each line, how do i:

1. determine how many lines (files) there are
2. pull out a specific line (file)

-thanks -Greg :-Q

flaga.gif
 

Code:
  Dim sFile As String
  Dim sLines() As String
  Dim nFile As Integer
  Dim sCont As String
  Dim nCount As Long
  
  sFile = "c:\list.dat"
  nFile = FreeFile
  
  sCont = Space$(FileLen(sFile))
  Open sFile For Binary As nFile
  Get nFile, 1, sCont
  Close nFile
  
  sLines = Split(sCont, vbCrLf)
  nCount = UBound(sLines) + 1
  
  Debug.Print "you have " & nCount & " files in the list"
  Debug.Print "item #5 is " & sLines(4)

contents of [tt]c:\list.dat[/tt]
[ignore]
N:\[03] Metallica - Holier Than Thou.mp3
N:\[02] Metallica - Sad But True.mp3
N:\[01] Metallica - Enter Sandman.mp3
N:\[04] Metallica - The Unforgiven.mp3
N:\[05] Metallica - Wherever I May Roam.mp3
N:\[06] Metallica - Don't Tread On Me.mp3
N:\[07] Metallica - Through The Never.mp3
N:\[08] Metallica - Nothing Else Matters.mp3
N:\[09] Metallica - Of Wolf And Man.mp3
N:\[10] Metallica - The God That Failed.mp3
N:\[11] Metallica - My Friend Of Misery.mp3
N:\[12] Metallica - The Struggle Within.mp3
[/ignore]
output:
[ignore]
you have 12 files in the list
item #5 is N:\[05] Metallica - Wherever I May Roam.mp3
[/ignore]
 
ok thanks for the quick reply, ill play around w/ that tomorrow... -Greg :-Q

flaga.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top