|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Byte to int Conversion ..??Hi
Is this a legal to convert from byte array to int array.. CopyMemory intAudio(0), byteAudio(0), 4096 Please help me out thanks sanjay Hi,
If you are using vs 2005 this will work. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim apf() As Byte = { _ 27, 32, 99, 147, 7, 141} Trace.WriteLine("") For Each b As Byte In apf trace.WriteLine(b) Next Dim ap() As Integer = Array.ConvertAll(apf, _ New Converter(Of Byte, Integer)(AddressOf ByteToInteger)) Trace.WriteLine("") For Each p As Integer In ap Trace.WriteLine(p) Next End Sub Public Shared Function ByteToInteger(ByVal pf As Byte) _ As Integer Return CInt(pf) End Function Ken ----------------------- Show quoteHide quote "Sanjay" <Sanjayrv***@gmail.com> wrote in message news:1145358108.933887.235320@z34g2000cwc.googlegroups.com... > Hi > Is this a legal to convert from byte array to int array.. > CopyMemory intAudio(0), byteAudio(0), 4096 > Please help me out > thanks > sanjay > Sanjay wrote:
> Hi Array.Copy byteAudio, intAudio, 4096> Is this a legal to convert from byte array to int array.. > CopyMemory intAudio(0), byteAudio(0), 4096 > Please help me out Because Byte can be automatically converted to Integer, you don't need a converison function. -- Larry Lard Replies to group please "Sanjay" <Sanjayrv***@gmail.com> schrieb: Check out the 'BitConverter' class.> Is this a legal to convert from byte array to int array.. > CopyMemory intAudio(0), byteAudio(0), 4096 -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> > Is this a legal to convert from byte array to int array.. Use System.Buffer.BlockCopy()Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
Weather board, how to get html data.
devenv.exe CPU 100% Get table names from MSAccess Datasource Easy Q: 0.0 --> Output as string? Ubound() Newbe help with Receive Serial Data Function Dropdownlist PNG control graphic abnomality Store Item Template with Project Checking occurances in a txt/ini file |
|||||||||||||||||||||||