473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to convert an sByte array to byte array

I have to convert an sByte array to byte array.
This sbyte array contains some signed values due to this .net
converting functions will throw an exception.any work around for this?

is there any way to pass sbyte array to stream classes eg: memory
stream?

Feb 21 '07 #1
3 6344
Howdy,

sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
byte[] dest = new byte[src.Length];
System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
--
Milosz
"reju" wrote:
I have to convert an sByte array to byte array.
This sbyte array contains some signed values due to this .net
converting functions will throw an exception.any work around for this?

is there any way to pass sbyte array to stream classes eg: memory
stream?

Feb 21 '07 #2
On Feb 21, 3:02 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
wrote:
Howdy,

sbyte[] src = new sbyte[] { -1, 1, -2, 2 };
byte[] dest = new byte[src.Length];
System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
--
Milosz

"reju" wrote:
I have to convert an sByte array to byte array.
This sbyte array contains some signed values due to this .net
converting functions will throw an exception.any work around for this?
is there any way to pass sbyte array to stream classes eg: memory
stream?

Great Milosz

it works
Thanks

Feb 21 '07 #3
On Feb 21, 3:54 am, "reju" <rejumgeo...@gmail.comwrote:
On Feb 21, 3:02 pm, Milosz Skalecki [MCAD] <mily...@DONTLIKESPAMwp.pl>
wrote:
Howdy,
sbyte[] src = newsbyte[] { -1, 1, -2, 2 };
byte[] dest = newbyte[src.Length];
System.Buffer.BlockCopy(src, 0, dest, 0, src.Length);
--
Milosz
"reju" wrote:
I have toconvertansBytearray tobytearray.
Thissbytearray contains some signed values due to this .net
converting functions will throw an exception.any work around for this?
is there any way to passsbytearray to stream classes eg: memory
stream?

Great Milosz

it works
Thanks
Yeah, Thanks too!

Mar 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Levine | last post by:
Using v1.1. of the framework: I was writing a wrapper around the java.util.zip.ZipOutputStream class so that my app could access it using standard FileStream semantics and I ran into a...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
2
by: [Gho] | last post by:
How to convert a Hexa value to negative and non negative value : if i get 0x1d = result should be 29 but if i get fd = result should be -3 How to do that
3
by: Steve - DND | last post by:
After downloading and using two different memory profiling applications today, it seems that sbyte, int16, and int32 are all stored using 12b of memory. Someone please tell me I'm reading these...
2
by: Ray Ackley | last post by:
I need to convert a byte to an sbyte - and it has to preserve the original binary meaning of the 8 bits. For example - a 1111 1111, which is interpreted as byte to be 255, should show up in the...
1
by: Darrel | last post by:
I am using binary writer to write an array of bytes to disk. However, my data starts out as an array of sbytes. I am currently type casting each array element in a for loop. Is there a faster...
2
by: jiangyh | last post by:
hi there : I have a question about how to convert Type to DbType? thanks a lot. jiangyh
6
by: Ricardo Quintanilla | last post by:
i have a code that sends data to a socket listening over as400 platform, the socket responds to me as a "byte array". then i need to convert the "byte array" into a string. the problem is that...
5
by: Pat Ireland | last post by:
I am attempting to pass an SByte to another .NET class that expects the data to be passed as SByte *. I searched around and found the boxing can be used to produce a pointer but I'm not sure if...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.