BASS.DLL Get string from byte pointer ?

BlitzMax Forums/BlitzMax Programming/BASS.DLL Get string from byte pointer ?

Filax(Posted 2007) [#1]
Hi
I'm trying to get a string from bass pointer with the function
Local ID:Byte Ptr()=BASS_StreamGetTags(MusicStream1.Stream,BASS_TAG_HTTP)

The bass doc say :
HTTP headers, only available when streaming from a HTTP
server. A pointer to a series of null-terminated strings is
returned, the final string ending with a double null.

My question is :
How to get this string from the BASS_StreamGetTags pointer ?

Cheers


grable(Posted 2007) [#2]
SuperStrict

Local s:String = "a~0b~0c~0~0"
Local p:Byte Ptr = s.ToCString()

For Local s:String = EachIn GetTags( p)
	Print ":" + s + ":"
Next
MemFree p

Function GetTags:String[]( data:Byte Ptr)
	Local tags:String[], i:Int
	Local s:Byte Ptr = data, e:Byte Ptr = data
	Repeat
		e :+ 1
		If e[0] = 0 Then
			i = tags.Length
			tags = tags[..i + 1]
			tags[i] = String.FromCString( s)
			s :+ (e-s) + 1
			e :+ 1
			If e[0] = 0 Then Exit
		EndIf
	Forever
	Return tags
EndFunction



Filax(Posted 2007) [#3]
Thanks Grable :)