Hi,
I have an application that stores raw .wav files (and also
jpgs/bitmaps) within strings, and I need to sometimes convert these
strings to byte arrays, and sometimes go from byte arrays back to
strings.
How do I convert this raw data from one format to another? I don't
think system.text.enc oding is useful here as the data is not in any
particular encoding format, it's just raw data and it needs to stay
that way. I have tried system.text.enc oding but it stuffs up the raw
data (unless I have chosen the wrong encoding, and I have tried many).
How do I convert from a string to a byte array and back again, without
having to do a for-next loop?
Thanks,
Richard 4 4008
Well, what encoding did you choose?
<mo*********@gm ail.com> wrote in message
news:11******** *************@t 31g2000cwb.goog legroups.com... Hi,
I have an application that stores raw .wav files (and also jpgs/bitmaps) within strings, and I need to sometimes convert these strings to byte arrays, and sometimes go from byte arrays back to strings.
How do I convert this raw data from one format to another? I don't think system.text.enc oding is useful here as the data is not in any particular encoding format, it's just raw data and it needs to stay that way. I have tried system.text.enc oding but it stuffs up the raw data (unless I have chosen the wrong encoding, and I have tried many).
How do I convert from a string to a byte array and back again, without having to do a for-next loop?
Thanks,
Richard
I tried ASCII, UT7, UT8, UNICODE. The resulting string (from a correct
byte array) is different to the byte array.
<mo*********@gm ail.com> wrote: I have an application that stores raw .wav files (and also jpgs/bitmaps) within strings, and I need to sometimes convert these strings to byte arrays, and sometimes go from byte arrays back to strings.
In that case you should use Base64 - use Convert.ToBase6 4String and
Convert.FromBas e64String. Encoding arbitrary binary data as strings
without care is very, very likely to cause you problems later on. Using
Base64 should keep you away from those problems.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Thank you :)
That solved my problems nicely. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ross Micheals |
last post by:
All
I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that I'm not sure are specific anomolies that I'm having, or if they are specific known issues I'm facing.
1. In VB.NET, are arrays stored on the stack...
|
by: Frank R Eid |
last post by:
Hi all;
A) What's the simplest way to convert a 'String' to 'char *' (and the other
way araound) ?
B) I have some C++ classes that I cannot easily convert to .NET (because
they still are to be used in non-.NET apps). Are there any critical issues
why i cannot use these 'as is' in my .NET app (beside of the 'new' and
'delete' of them...
|
by: Wayne |
last post by:
A field within a FoxPro database typed as a BLOB is
reported as s System.String when accessed using Vb.Net.
Attempting to fetch the binary data into a .NET string
fetches only the first few characters and stops at the
first non-character element.
Any attempt to alter the field type using VB.NET is not
allowed. Casting the data generates an...
|
by: Metallicraft |
last post by:
Is a vb6 byte array the same as a vb.net byte array?
|
by: marfi95 |
last post by:
Hi all.
I need to copy a byte array into a string, but starting at a specific
location in the byte array. This is where I get hung up. For example if
my byte array is (100) big, I might want to start at position 60 for
example and copy from 60 to the next null byte in the array to my
string. The starting position is variable, as is where...
| |
by: elavarasar |
last post by:
How to use Calendar control in ASP.Net ( Back end Oracle 9i)
Please give brief example for understanding.
|
by: MattB |
last post by:
Slightly OT, but I know someone must know off the top of their head (and
this is for a asp.net application).
I have a one dimensional array of a string type that was created using
String.Split. I now want to add an additional dimension without losing
what's stored in the original array. Suggestions? Thanks!
Matt
|
by: sana krishna |
last post by:
How can we take the value of a variable in javascript function to the ASP.NET string
I wish to display the value of P using Response.write when I click the Button.
//my code
<html>
<form>
<input type="Button" onclick="count();"/>
</form>
</html>
<script language='javascript'>
|
by: eBob.com |
last post by:
Is there a regex pattern which will match a VB.Net string? I.E. a regex
which matches ...
"this is a ""vb.net"" string"
(I don't want three matches in this case, I want one.) I've come up with
various solutions for the two-double-quotes-in-a-row problem but none of
them have worked out.
Thanks, Bob
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |