-
I almost feel too embarassed to ask this, but does anyone know a better way to convert a string to a byte array? I don't like using loops to process the string char by char. It's easy to convert a byte array to a string, you just use StrConv. There must be a VB function I'm missing or an API call. I mean a string is just a block of bytes in memory anyways. Anybody know a good way to do this?
-
Thank you franz, beat me too it
I actually only figured out how to do the str -> byte() because of this question.
good place to learn, this is
-
Yeah Thanks Franz, I really needed that
-
Yeah Thanks Franz, I really needed that!
Only one question, when would I use that or better yet, why would Songouki need to convert? ;)
Sorry, I don't work with byte array that much beside with the internet transfer control.
-
Thanks for the responses guys, I was beginning to think nobody was going to answer this thread! As for the solution, all I can say is D'oh! I tried to convert using StrConv, but it didn't work the first couple of times so I figured it wouldn't work at all! My own fault, live and learn, I guess.
There are many useful reasons for wanting this, such as:
- Many API calls require byte arrays instead of strings and won't work when modified to accept a string.
- Processing and manipulating Binary files quickly.
- Handling strings char by char (like C) and converting them back.
...and many more.
Anyway, thanks again guys this really helps!
-
I aggree, working with strings is fine in memory but when you're dealing with files binary is SOOOOO much faster and more flexible.
I've often converted bytes() to string but not really needed to do the reverse, I saw this question and realizeed it was something I wanted to be able to do,
Thanks SonGouki, excellent question (it got me off my arse to learn something :))