Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello code project..
i was converted my mp3 file to bytearray and i decided to save it and in the next time i want to convert it again to mp3.

yet to convert my mp3 file to bytearray, i am using this code :

VB
Dim bString As New System.Text.StringBuilder
Dim bArray As Byte() = IO.File.ReadAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\a.mp3")
For Each b As Byte In bArray
    bString.Append(CInt(b))
Next
RichTextBox1.Text = bString.ToString


but now how to convert bytearray in the RichTextBox1.Text to mp3 file again?
i am used this code but not work, mp3 file created but no sound :(

VB
File.WriteAllText("C:\\a.mp3", RichTextBox1.Text)


thank you
Posted
Updated 25-Nov-13 19:57pm
v2
Comments
Sergey Alexandrovich Kryukov 26-Nov-13 2:40am    
Why?!
—SA
Mehdi Gholam 26-Nov-13 2:33am    
Why are you using a StringBuilder for byte data?
Sergey Alexandrovich Kryukov 26-Nov-13 2:44am    
Of course. I answered...
—SA

1 solution

Forget string and text! The solution is seen with unarmed eye: if you used ReadAllBytes to read, apparently, you need to use WriteAllBytes to write:
http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Mehdi Gholam 26-Nov-13 2:48am    
Exactly! 5'ed
Sergey Alexandrovich Kryukov 26-Nov-13 2:53am    
Thank you, Mehdi.
—S
Gun Gun Febrianza 26-Nov-13 4:06am    
thank you sir for help me :)
sorry iam late to reply your solution ..
Gun Gun Febrianza 26-Nov-13 4:10am    
sorry iam late to reply.. hehe thankyou sir your link give me some solution :)
Sergey Alexandrovich Kryukov 26-Nov-13 11:18am    
No problems with late or soon replies, ever. :-)
You are very welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900