473,480 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to transform a Struct into a byte array

Hi. Can you help me on this? I have the following:
MyStruct myStruct = new MyStruct ();

Then a function filled up myStruct. Now I need to read the struct data byte
by byte because I have a "dwParam1Offset" and a "dwParam1Size" in it that
contains an unicode string which I need to have.

Is there any way of retrieving this information? Maybe I really don't need
to have a byte array and there's another way.. I'm lost in this. Can you
please give me a hand?

Thanks

Ignacio Domínguez
Nov 13 '05 #1
0 1407

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

Similar topics

19
3047
by: Geetesh | last post by:
Recently i saw a code in which there was a structer defination similar as bellow: struct foo { int dummy1; int dummy2; int last }; In application the above array is always allocated at...
36
4373
by: Eric Laberge | last post by:
Hi! I'm working on automatically generated code, and need to assign arrays. memcpy is an obvious solution, but it becomes complicated to use in the context I'm working on, ie.: I could use it...
0
1872
by: William Stacey | last post by:
The following code works, but I can't figure out why. I take a struct with two members, a single byte and byte. I then marshal the whole struct to a byte. I create a new struct (without init'ing...
3
14473
by: Pablo Gutierrez | last post by:
I have a C# method that reads Binary data (BLOB type) from a database and returns the data an array of bytes (i.e byte outbyte = new byte;). The BLOB column is saved into the database by a C...
15
43474
by: Ken Allen | last post by:
I have some code from C/C++ that I am attempting to port to C#. I have come across an interesting problem that is quite common in complex C/C++ code: the us of UNION in structure definitions to...
5
5305
by: Amil Hanish | last post by:
I have a huge byte array from another API that contains structs of differing sizes. I'd like to create n structs based on data in the byte array. But how? For example, if I want to take bytes...
3
11435
by: GrkEngineer | last post by:
I recently had to use someone's struct from a native app to receive data over Udp. The struct has a array member which looked like this: struct sensorHdr{ char sName; }; When I tried to make...
0
1094
by: ambeer | last post by:
Hello, i have created the struct: #region PacketStructures struct MainPacket { HeaderData headerData; public byte moduleType; ...
5
1492
by: Chris Saunders | last post by:
Here is the C declaration of a struct from Windows: typedef struct _TXFS_READ_BACKUP_INFORMATION_OUT { union { // // Used to return the required buffer size if return code is...
0
6911
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
7050
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
7091
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...
1
6743
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...
0
5344
agi2029
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,...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2999
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...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
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...

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.