473,388 Members | 1,496 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,388 software developers and data experts.

help..i'm stuck here

Hi guys,
May i know how to declare a string of binary data and pass it to the method?
For example, int a[]={10010001120420052314}
is it correct?
and if i have receive the binary data, may i know how to separate them and
store each of them inside a variable such as int cust_id?is it possible? For
example, the first four bits is the customer id, the second four bits is the
call id and third 8 bits is the date and the remaining is the time..

thanks in advance..

Nov 16 '05 #1
3 1440
? Your example isn't a binary string to begin with... 2, 3, 4, 5 aren't
binary digits...

Are you trying to pass this as a string? If so, what's the advantage to
converting it to binary first? The only advantage to converting your items
and "packing" them into binary format would be the space savings and faster
speed of transmission over the wire. If you're converting them to a String
of "1" and "0" characters, you're completely defeating any space or speed
enhancements.

"alyssa" <al****@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Hi guys,
May i know how to declare a string of binary data and pass it to the
method?
For example, int a[]={10010001120420052314}
is it correct?
and if i have receive the binary data, may i know how to separate them and
store each of them inside a variable such as int cust_id?is it possible?
For
example, the first four bits is the customer id, the second four bits is
the
call id and third 8 bits is the date and the remaining is the time..

thanks in advance..

Nov 16 '05 #2
oh..ya.i wan to pass it as a string....then separate them according to the
attributes...may know how to do it?

"Michael C#" wrote:
? Your example isn't a binary string to begin with... 2, 3, 4, 5 aren't
binary digits...

Are you trying to pass this as a string? If so, what's the advantage to
converting it to binary first? The only advantage to converting your items
and "packing" them into binary format would be the space savings and faster
speed of transmission over the wire. If you're converting them to a String
of "1" and "0" characters, you're completely defeating any space or speed
enhancements.

"alyssa" <al****@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Hi guys,
May i know how to declare a string of binary data and pass it to the
method?
For example, int a[]={10010001120420052314}
is it correct?
and if i have receive the binary data, may i know how to separate them and
store each of them inside a variable such as int cust_id?is it possible?
For
example, the first four bits is the customer id, the second four bits is
the
call id and third 8 bits is the date and the remaining is the time..

thanks in advance..


Nov 16 '05 #3
This will do what you're asking. It will convert an Integer to a Binary
String representation:

Function ToBin(ByVal i As Integer) As String
Dim BinaryDigits() As String = {"0000", "0001", "0010", "0011", _
"0100", "0101", "0110", "0111", _
"1000", "1001", "1010", "1011", _
"1100", "1101", "1110", "1111"}
Dim HexDigits As String = "0123456789abcdef"
Dim sb As New System.Text.StringBuilder(256)
Dim strHex As String = Hex(i).ToLower()
For Each c As Char In strHex
sb.Append(BinaryDigits(HexDigits.IndexOf(c)))
Next
Return (sb.ToString())
End Function

Other than for Display Purposes (assuming you need to view an integer on
your screen in Binary format), there is no added value to this function.

"alyssa" <al****@discussions.microsoft.com> wrote in message
news:5F**********************************@microsof t.com...
oh..ya.i wan to pass it as a string....then separate them according to the
attributes...may know how to do it?

"Michael C#" wrote:
? Your example isn't a binary string to begin with... 2, 3, 4, 5 aren't
binary digits...

Are you trying to pass this as a string? If so, what's the advantage to
converting it to binary first? The only advantage to converting your
items
and "packing" them into binary format would be the space savings and
faster
speed of transmission over the wire. If you're converting them to a
String
of "1" and "0" characters, you're completely defeating any space or speed
enhancements.

"alyssa" <al****@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
> Hi guys,
> May i know how to declare a string of binary data and pass it to the
> method?
> For example, int a[]={10010001120420052314}
> is it correct?
> and if i have receive the binary data, may i know how to separate them
> and
> store each of them inside a variable such as int cust_id?is it
> possible?
> For
> example, the first four bits is the customer id, the second four bits
> is
> the
> call id and third 8 bits is the date and the remaining is the time..
>
> thanks in advance..
>


Nov 16 '05 #4

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

Similar topics

1
by: Will Stuyvesant | last post by:
There seems to be no XML parser that can do validation in the Python Standard Libraries. And I am stuck with Python 2.1.1. until my web master upgrades (I use Python for CGI). I know pyXML has...
5
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more...
7
by: Jack Addington | last post by:
I've got a fairly simple application implementation that over time is going to get a lot bigger. I'm really trying to implement it in a way that will facilitate the growth. I am first writing a...
7
by: c#2006user | last post by:
Hi everyone. i know there is a lot of code and ive reduced it as much as i could, its a bit much to ask but i am really stuck! i've been at this for a week! this is converted from vb to c# and...
11
by: c19h28o2 | last post by:
Hi, Guy's I know there are several posts about this, however I do not want to read them as answers are undoubtedly posted! Here is my attempt but I'm slightly stuck. I'm not looking for the...
0
by: RENEE | last post by:
I HAVE STARTED MY PROJECT AND I HAVE GOT STUCK, I AM NOT SURE IF IM DOING THINGS RIGHT, MY PROGRAM NEEDS TO BE ABLE TO ADD NAMES TO A SEQUENTIAL FILE AND BE ABLE TO READ FROM THERE AND IM STUCK, IF...
5
by: Paul M | last post by:
Hi I need to create a map for a room (chairs, bed, TV, forniture, etc). All object allready exists like png images. I need to create a map for each room, i mean the user need to create. How...
11
by: Peted | last post by:
Im using c# 2005 express edition Ive pretty much finished an winforms application and i need to significantly improve the visual appeal of the interface. Im totaly stuck on this and cant seem...
9
by: ajos | last post by:
Hello friends, After thinking about this for sometime, i decided to post this in the java forum. Well my problem here in detail is, i have 3 jsp pages where in a.jsp(for example) i have a combo...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...

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.