hey,
When I convert a byte[] into string values I do it like this:
TextBox2.Text = System.Text.Enc oding.ASCII.Get String(buffer, 0, 31);
where buffer is my byte array where my data is stored.
Can someone tell me what I would need to do , if I have to extract the
unsigned short value from my byte array??
Thanks. 2 5457
Moni,
Call the static ToUInt16 method on the BitConverter class.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"moni" <mo*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
hey,
When I convert a byte[] into string values I do it like this:
TextBox2.Text = System.Text.Enc oding.ASCII.Get String(buffer, 0, 31);
where buffer is my byte array where my data is stored.
Can someone tell me what I would need to do , if I have to extract the
unsigned short value from my byte array??
Thanks.
Thanks alot Nicholas!
Nicholas Paldino [.NET/C# MVP] wrote:
Moni,
Call the static ToUInt16 method on the BitConverter class.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"moni" <mo*******@gmai l.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
hey,
When I convert a byte[] into string values I do it like this:
TextBox2.Text = System.Text.Enc oding.ASCII.Get String(buffer, 0, 31);
where buffer is my byte array where my data is stored.
Can someone tell me what I would need to do , if I have to extract the
unsigned short value from my byte array??
Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bryan Parkoff |
last post by:
I have two variables: "char A" and "short B". I can be able to convert
from A to B using explicit case conversion with no problem like "B = short
(A);". Right now, I have two variables: "char T" and "short A". T has
an array of six elements. I desire to capture first element and second
element as two bytes into word as short.
The problem is that "A" captures only one element instead of two
elements. I have looked at machine language...
|
by: kevinniu |
last post by:
Hi everyone,
In c#, what is the fastest way(include unsafe) to
convert a array of bytes(which really contains the
bytes of a double array) to a arry of double.
thanks
|
by: Gordon Knote |
last post by:
Hi
I've got the following problem:
In one of my programs I receive a string that contains a hex number (e.g. "B4"). Now, I want to convert this "number" into a var of type BYTE. How can this be done
Thanks a lo
Gordon
|
by: Howard Weiss |
last post by:
I am reading a file (containing short integers). To read the file, I use
the following
FileStream *myFile = new FileStream(FileName, FileMode::Open,
FileAccess::Read);
__int64 myFileSize = myFile->get_Length();
Byte myFileData;
myFile1Data = new Byte;
|
by: aengus |
last post by:
Hi,
I am looking to find out how to deal with the BYTE datatype in VC, as
used below:
This struct is part of the API for a Garmin GPS unit:
typedef struct
{
unsigned char mPacketType; // 0 1 byte
| |
by: Eric BOUXIROT |
last post by:
hi,
i must convert all of these eVC++ prototypes to use with VB.NET....
DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_CalculAXplusB(short int *IN_Tab_entree ,int IN_taille
,
double *OUT_Tab_sortie_freq ,
double *OUT_Tab_sortie, double IN_A,
|
by: kyle.tk |
last post by:
I am trying to write a function to convert an ipv4 address that is held
in the string char *ip to its long value equivalent. Here is what I
have right now, but I can't seem to get it to work.
#include <string.h>
#include <stdio.h>
/* Convert an ipv4 address to long integer */
/* "192.168.1.1" --> 3232235777 */
unsigned long iptol(char *ip){
|
by: Manuel |
last post by:
hi,
I have a problem, a stupid problem. I can't declare a variable of type
byte.
The g++ said that i have syntactic error in this line. The code is
this: byte * variable;
well, i think that the mistake is a stupidity but i don't find it.
where is it?
|
by: farnaz.shahed |
last post by:
Hi,
This what I'm basically supposed to do. If i have a byte which looks
like this 00010000, i need to convert it to 11110000. That would mean
if any of the bit fields is 1....all the bit fields to the left of it
should be made 1.
I tried using left shift n right shift operators but that didnt
help...any other suggesstions pls?
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |