|
-
Apr 18th, 2000, 01:40 AM
#1
Thread Starter
Addicted Member
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?
-
Apr 18th, 2000, 10:55 PM
#2
Fanatic Member
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
-
Apr 19th, 2000, 12:00 AM
#3
transcendental analytic
Yeah Thanks Franz, I really needed that
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 19th, 2000, 12:11 AM
#4
Fanatic Member
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.
Chemically Formulated As:
Dr. Nitro
-
Apr 19th, 2000, 12:24 AM
#5
Thread Starter
Addicted Member
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!
-
Apr 19th, 2000, 11:41 AM
#6
Fanatic Member
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 )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|