[VB] Wel Get, niet Put?

Pagina: 1
Acties:

  • dlmh
  • Registratie: Januari 2000
  • Laatst online: 15-09 11:23
Haai!

Ik ben bezig een ID3-tag convertor te bouwen in VB om aan de hand van de bestandsnaam de ID3 tag 1/2 aan te maken (scheelt veel handmatig werk)

Nu kan ik prima de ID3 tag uitlezen met het volgende:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    Dim Tag As String * 125
    offset = FileLen(listMP3.List(listMP3.ListIndex)) - 124
    
    Open (listMP3.List(listMP3.ListIndex)) For Binary As #1
    
      Get #1, offset, Tag$
      
    Close #1
        
    txtTitle.Text = Left$(Tag$, 30)
    txtArtist.Text = Mid$(Tag$, 31, 30)
    txtAlbum.Text = Mid$(Tag$, 61, 30)
    txtYear.Text = Mid$(Tag$, 91, 4)
    txtComment.Text = Mid$(Tag$, 95, 30)
    txtTrack.Text = Left$(listMP3.List(listMP3.ListIndex), 2)

Maar met (practisch) hetzelfde kan ik het niet wegschrijven, dan krijg ik nl. een file acces error... dit heb ik om weg te schrijven:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
    Dim Tag2 As String * 125
    
    For x = 0 To (listMP3.ListCount - 1)
    
      titel$ = Mid$(listMP3.List(x), 6, (Len(listMP3.List(x)) - 9))
      stringie$ = titel$
      
      For a = 1 To (30 - Len(titel$))
      
        stringie$ = stringie$ + " "
        
      Next a
      
      stringie$ = stringie$ + txtArtist.Text + txtAlbum.Text
      
      For a = 1 To 34
      
        stringie$ = stringie$ + " "
      
      Next a
      
      Tag2$ = stringie$
      offset = FileLen(listMP3.List(x)) - 124
      Text1.Text = Text1.Text + Str$(offset) + " "
      Text2.Text = Text2.Text + Tag2$
      Text3.Text = Text3.Text + Str$((30 - Len(titel$))) + " "
      Text4.Text = Text4.Text + Str$(Len(Tag2$)) + " "
      
      
      pad$ = Dir1.Path + "\" + (listMP3.List(x))
      Open pad$ For Output As #1
      
        Put #1, offset, Tag2$
        
      Close #1
      
    Next x
    
    Text4.Text = Text4.Text + Str$(Len(Text2.Text)) + " " + pad$

Wie helpt mij?

“If a cluttered desk is a sign of a cluttered mind, of what, then, is an empty desk a sign?” - Albert Einstein


  • .oisyn
  • Registratie: September 2000
  • Laatst online: 08:34

.oisyn

Moderator Devschuur®

Demotivational Speaker

Misschien een dom antwoord, maar is die mp3 niet toevallig geopend in een ander programma?

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


Verwijderd

Trap je filemode ook es naar binary voor schrijven?

  • .oisyn
  • Registratie: September 2000
  • Laatst online: 08:34

.oisyn

Moderator Devschuur®

Demotivational Speaker

binary is altijd zowel lezen als schrijven dacht ik

.edit: oh wacht ik begrijp je verkeerd :)
Ja idd, je opent m voor output, maar dan kun je niet putten, dus je moet m ook openen als binary

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


  • Gerco
  • Registratie: Mei 2000
  • Laatst online: 14-09 17:42

Gerco

Professional Newbie

Volgens mij ben je ook je mp3 kwijt als je 'em voor output opent. Als je een textfile for Output opent ben je iig de vorige inhoud kwijt. Een .mp3 file is niet anders lijkt me.

- "Als ik zou willen dat je het begreep, legde ik het wel beter uit!" | All number systems are base 10!


  • dlmh
  • Registratie: Januari 2000
  • Laatst online: 15-09 11:23
Jongens, bedankt voor de antwoorden!

Heb later ff script opnieuw geschreven.... moest idd op binary, maar kwam er ook achter dat al m'n MP3's op ReadOnly stonden (tja... dat krijg je als je ze van CD copieert...)

Groetjes!

“If a cluttered desk is a sign of a cluttered mind, of what, then, is an empty desk a sign?” - Albert Einstein


  • Pc123
  • Registratie: Oktober 2000
  • Laatst online: 15-09 20:53
Kun je ook automatisch doen met SetAttr
Pagina: 1