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

Problem casting a byte[] to a class

I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?
Oct 23 '06 #1
12 3284
Your assuming the data is sequentially stored and no other data exist in the
class, both assumptions are incorrect.

Normally you can serialize your class and desterilized but if the data needs
to be in a compact byte array which I have found need for several times you
will need to parse the data manually. I think you can overload the
serialization function but I have found the below simpler.

class TestA {
public ushort val1;
public ushort val2;
public ushort val3;

public TestA(byte[] data)
{
val1 = BitConverter.ToUInt16(0);
val2 = BitConverter.ToUInt16(2);
val3 = BitConverter.ToUInt16(4);
}
public ToArray
{
get {
MemoryStream ms = new MemoryStream();
ms.Wirte(BitConverter.GetBytes(val1, 0, 2);
ms.Wirte(BitConverter.GetBytes(val2, 0, 2);
ms.Wirte(BitConverter.GetBytes(val3, 0, 2);
ms.Capacity = ms.Length;
return ms.ToArray();
}
}
}

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?

Oct 23 '06 #2
O.B. <fu******@bellsouth.netwrote:
I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.
You can't do that in C# (thank goodness, IMO). You should either look
at serialization, or add a method to TestA to convert an array of bytes
(or a stream) into an instance of TestA.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 23 '06 #3
Oh by the way if you convert to a structure and set the offsets manually you
can then do a memory copy to accomplish what you did in C.

Sort of like this, don't do it as often so a little fuzzer on how.

[StructLayout(LayoutKind.Explicit)]
public struct TestA
{
[FieldOffset(0)] public ushort Val1;
[FieldOffset(2)] public ushort Val2;
[FieldOffset(4)] public ushort Val2;
}

Marshal.Copy(Data, 0, IntPtr <TestA>, 6);

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?

Oct 23 '06 #4
John J. Hughes II <no@invalid.comwrote:
Your assuming the data is sequentially stored and no other data exist in the
class, both assumptions are incorrect.

Normally you can serialize your class and desterilized but if the data needs
to be in a compact byte array which I have found need for several times you
will need to parse the data manually. I think you can overload the
serialization function but I have found the below simpler.
Note that for your solution, the line

ms.Capacity = ms.Length;

is unnecessary.

Personally, I'd prefer to create the 6 byte array to start with, and
then populate it. The "standard" BitConverter doesn't have any way to
convert into the middle of an existing array, but my own one does :)

See http://www.pobox.com/~skeet/csharp/miscutil and the
EndianBitConverter class.

In this case, the code might be (converting it to a method rather than
a property);

public byte[] ToArray()
{
EndianBitConverter converter = EndianBitConverter.Little;
byte[] ret = new byte[6];
converter.CopyBytes (val1, ret, 0);
converter.CopyBytes (val2, ret, 2);
converter.CopyBytes (val3, ret, 4);
return ret;
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Oct 23 '06 #5
Actually, the code is bit more complex than what I posted. I'm reading
data off of socket. In C++, I used a static_cast to cast the data to a
union. In C#, I have used StructLayout and FieldOffset to acquire the
"union" behavior. I just need the ability to overlay a structure
(perhaps better than a class for this use case) on top of that byte array.

The problem that I have with "as" when I use a struct is the following
error:
The as operator must be used with a reference type ('TEST.TestA' is a
value type)

Also, I really can't do an assignment on a per attribute basis. The
data received over the socket is in big endian. I prefer to store it in
big-endian and not waste any CPU cycles to convert it to little endian
(speed is key in this application). The implicit and explicit operators
are overridden to query header information from the data received. The
data is then forwarded over many other socket connections in big-endian
format; thus no byte-swapping conversions are required for the majority
of the received data.

Is there no way in C# to map a struct directly on top of a block of memory?

John J. Hughes II wrote:
Your assuming the data is sequentially stored and no other data exist in the
class, both assumptions are incorrect.

Normally you can serialize your class and desterilized but if the data needs
to be in a compact byte array which I have found need for several times you
will need to parse the data manually. I think you can overload the
serialization function but I have found the below simpler.

class TestA {
public ushort val1;
public ushort val2;
public ushort val3;

public TestA(byte[] data)
{
val1 = BitConverter.ToUInt16(0);
val2 = BitConverter.ToUInt16(2);
val3 = BitConverter.ToUInt16(4);
}
public ToArray
{
get {
MemoryStream ms = new MemoryStream();
ms.Wirte(BitConverter.GetBytes(val1, 0, 2);
ms.Wirte(BitConverter.GetBytes(val2, 0, 2);
ms.Wirte(BitConverter.GetBytes(val3, 0, 2);
ms.Capacity = ms.Length;
return ms.ToArray();
}
}
}

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?

Oct 23 '06 #6
This is *real* close to what I want. The only drawback is that I'm
having to instantiate new memory for the TestA structure before calling
Marshal. The UdpClient is already returning an allocated byte array.
This application has to run as close to real-time as possible.

TestA test;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
Marshal.Copy(testArray, 0, (IntPtr)(&test), 6);

John J. Hughes II wrote:
Oh by the way if you convert to a structure and set the offsets manually you
can then do a memory copy to accomplish what you did in C.

Sort of like this, don't do it as often so a little fuzzer on how.

[StructLayout(LayoutKind.Explicit)]
public struct TestA
{
[FieldOffset(0)] public ushort Val1;
[FieldOffset(2)] public ushort Val2;
[FieldOffset(4)] public ushort Val2;
}

Marshal.Copy(Data, 0, IntPtr <TestA>, 6);

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?

Oct 23 '06 #7
See my other post with [StructLayout(LayoutKind.Explicit)] and Marshal.Copy.

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
Actually, the code is bit more complex than what I posted. I'm reading
data off of socket. In C++, I used a static_cast to cast the data to a
union. In C#, I have used StructLayout and FieldOffset to acquire the
"union" behavior. I just need the ability to overlay a structure (perhaps
better than a class for this use case) on top of that byte array.

The problem that I have with "as" when I use a struct is the following
error:
The as operator must be used with a reference type ('TEST.TestA' is a
value type)

Also, I really can't do an assignment on a per attribute basis. The data
received over the socket is in big endian. I prefer to store it in
big-endian and not waste any CPU cycles to convert it to little endian
(speed is key in this application). The implicit and explicit operators
are overridden to query header information from the data received. The
data is then forwarded over many other socket connections in big-endian
format; thus no byte-swapping conversions are required for the majority of
the received data.

Is there no way in C# to map a struct directly on top of a block of
memory?

John J. Hughes II wrote:
>Your assuming the data is sequentially stored and no other data exist in
the class, both assumptions are incorrect.

Normally you can serialize your class and desterilized but if the data
needs to be in a compact byte array which I have found need for several
times you will need to parse the data manually. I think you can overload
the serialization function but I have found the below simpler.

class TestA {
public ushort val1;
public ushort val2;
public ushort val3;

public TestA(byte[] data)
{
val1 = BitConverter.ToUInt16(0);
val2 = BitConverter.ToUInt16(2);
val3 = BitConverter.ToUInt16(4);
}
public ToArray
{
get {
MemoryStream ms = new MemoryStream();
ms.Wirte(BitConverter.GetBytes(val1, 0, 2);
ms.Wirte(BitConverter.GetBytes(val2, 0, 2);
ms.Wirte(BitConverter.GetBytes(val3, 0, 2);
ms.Capacity = ms.Length;
return ms.ToArray();
}
}
}

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
>>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?
Oct 23 '06 #8
Jon,

Most of my solutions (problems) have the wrong Endean so I also have a class
for converting. Maybe someday when I have time I will look at yours, you
might have some better ways of handling problems.

Yes you are correct about the ToArray, when I first write the function I was
using the GetBuffer function which was returning the entire capacity. I
later switch to the ToArray function and never removed it, thanks for the
pointer.

Regards,
John

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
John J. Hughes II <no@invalid.comwrote:
>Your assuming the data is sequentially stored and no other data exist in
the
class, both assumptions are incorrect.

Normally you can serialize your class and desterilized but if the data
needs
to be in a compact byte array which I have found need for several times
you
will need to parse the data manually. I think you can overload the
serialization function but I have found the below simpler.

Note that for your solution, the line

ms.Capacity = ms.Length;

is unnecessary.

Personally, I'd prefer to create the 6 byte array to start with, and
then populate it. The "standard" BitConverter doesn't have any way to
convert into the middle of an existing array, but my own one does :)

See http://www.pobox.com/~skeet/csharp/miscutil and the
EndianBitConverter class.

In this case, the code might be (converting it to a method rather than
a property);

public byte[] ToArray()
{
EndianBitConverter converter = EndianBitConverter.Little;
byte[] ret = new byte[6];
converter.CopyBytes (val1, ret, 0);
converter.CopyBytes (val2, ret, 2);
converter.CopyBytes (val3, ret, 4);
return ret;
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Oct 23 '06 #9
O.B. wrote:
I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?
O.B.,

The other guys have explained quite well why you can't do it; and why you
shouldn't do it. You've got to remember C# is a managed programming
language, it doesn't usually have access to raw memory and the same types
of clevery you can do with C++, et al.

However, this is how you do it:

Firstly, define your TestA as a struct, and give it the attribute of
LayoutKind.Sequential:

///
[StructLayout(LayoutKind.Sequential)]
public struct TestA
{
public ushort val1;
public ushort val2;
public ushort val3;
}
///

Then your new test method should read:

///
static void Main( string[] args )
{
TestA test;

byte[] testArray = new byte[6];
for ( int i = 0; i < testArray.Length; i++ )
testArray[i] = (byte)(i + 1);

IntPtr arrayPtr = Marshal.UnsafeAddrOfPinnedArrayElement( testArray, 0 );
test = (TestA) Marshal.PtrToStructure( p, typeof( TestA ) );
}
///

So, the start of the code is the same (loading your array), then the next
two lines perform the magic. The first gets a pointer to the start of the
byte array, and stores it in arrayPtr. The second then generates the
structure, given that pointer and the type of structure being generated.

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 23 '06 #10
Tom Spink wrote:
O.B. wrote:
>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?

O.B.,

The other guys have explained quite well why you can't do it; and why you
shouldn't do it. You've got to remember C# is a managed programming
language, it doesn't usually have access to raw memory and the same types
of clevery you can do with C++, et al.

However, this is how you do it:

Firstly, define your TestA as a struct, and give it the attribute of
LayoutKind.Sequential:

///
[StructLayout(LayoutKind.Sequential)]
public struct TestA
{
public ushort val1;
public ushort val2;
public ushort val3;
}
///

Then your new test method should read:

///
static void Main( string[] args )
{
TestA test;

byte[] testArray = new byte[6];
for ( int i = 0; i < testArray.Length; i++ )
testArray[i] = (byte)(i + 1);

IntPtr arrayPtr = Marshal.UnsafeAddrOfPinnedArrayElement( testArray, 0
); test = (TestA) Marshal.PtrToStructure( p, typeof( TestA ) );
}
///

So, the start of the code is the same (loading your array), then the next
two lines perform the magic. The first gets a pointer to the start of the
byte array, and stores it in arrayPtr. The second then generates the
structure, given that pointer and the type of structure being generated.
I made a slight error while I was touch-typing from monitor 1, to monitor 2:

On the line of code that is PtrToStructure, I left the first parameter as p,
when in fact it should be arrayPtr. Appologies.

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 23 '06 #11
I don't understand why you are coping the data from one array to another,
just use the array the UdpClient is giving you.

Personally I normally use socket and have found the socket can not give you
data as fast as you can process it so you will be spending more time idle
anyway so you might be trying to optimize something more then needed.

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
This is *real* close to what I want. The only drawback is that I'm having
to instantiate new memory for the TestA structure before calling Marshal.
The UdpClient is already returning an allocated byte array. This
application has to run as close to real-time as possible.

TestA test;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
Marshal.Copy(testArray, 0, (IntPtr)(&test), 6);

John J. Hughes II wrote:
>Oh by the way if you convert to a structure and set the offsets manually
you can then do a memory copy to accomplish what you did in C.

Sort of like this, don't do it as often so a little fuzzer on how.

[StructLayout(LayoutKind.Explicit)]
public struct TestA
{
[FieldOffset(0)] public ushort Val1;
[FieldOffset(2)] public ushort Val2;
[FieldOffset(4)] public ushort Val2;
}

Marshal.Copy(Data, 0, IntPtr <TestA>, 6);

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
>>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?
Oct 23 '06 #12

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
This is *real* close to what I want. The only drawback is that I'm having
to instantiate new memory for the TestA structure before calling Marshal.
The UdpClient is already returning an allocated byte array. This
application has to run as close to real-time as possible.
This whole business breaks all type-safety rules (only the BitConverter
method was type-safe).

If that's ok with you, and it sounds like it is, then use explicit layout
and pointers inside an unsafe block.

>
TestA test;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
Marshal.Copy(testArray, 0, (IntPtr)(&test), 6);

John J. Hughes II wrote:
>Oh by the way if you convert to a structure and set the offsets manually
you can then do a memory copy to accomplish what you did in C.

Sort of like this, don't do it as often so a little fuzzer on how.

[StructLayout(LayoutKind.Explicit)]
public struct TestA
{
[FieldOffset(0)] public ushort Val1;
[FieldOffset(2)] public ushort Val2;
[FieldOffset(4)] public ushort Val2;
}

Marshal.Copy(Data, 0, IntPtr <TestA>, 6);

Regards,
John

"O.B." <fu******@bellsouth.netwrote in message
news:12*************@corp.supernews.com...
>>I'm trying to do a static_cast at runtime in C# and as I understand it,
"as" is the keyword to use. Unfortunately, the compiler is trying to do
the cast a compilation time. See below.

/* TestA.cs */
namespace TEST {
class TestA {
public ushort val1;
public ushort val2;
public ushort val3;
}
}

/* Main Program */
namespace TEST {
class Program {
static void Main(string[] args) {
TestA test = null;
byte[] testArray = new byte[6];
for (int i = 0; i < testArray.Length; i++) {
testArray[i] = (byte)(i + 1);
}
// Trying to do a C++-style static_cast
// Compilation error:
// Cannot convert type 'byte[]' to 'TEST.TestA'
// via a built-in conversion
test = testArray as TestA;
}
}
}

What am I doing wrong?
Oct 23 '06 #13

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

Similar topics

4
by: Kevin | last post by:
Hi I try the following program and I get InvalidCastException at the line MyByte b = (MyByte)obj; If I change it to MyByte b = (MyByte)d;
4
by: Jacob Jensen | last post by:
This question has probably been asked a million time, but here it comes again. I want to learn the difference between the three type cast operators: static_cast, reinterpret_cast, dynamic_cast. A...
4
by: vertigo | last post by:
Hello I have: struct packet{ byte type; /*my byte is unsigned char*/ int len; } struct packet *p = new struct packet; p->type=10; p->len=0;
4
by: Harry | last post by:
Hi ppl Some problem regarding pointer: ULONG *addr; CHAR *ptr=NULL; addr=new ULONG; //calling a function and getting the addr value //ULONG is 4 bytes. I am getting the Ip address which...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
7
by: The Last Gunslinger | last post by:
We have an enum: public enum EnumDays { Sun = 1, Mon = 2, ... } We can store it as a byte:
61
by: Ken Allen | last post by:
I am relatively new to .Net, but have been using VB and C/C++ for years. One of the drawbacks with VB6 and earlier was the difficulty in casting a 'record' to a different 'shape' so one could...
3
by: Stacey Levine | last post by:
I have a webservice that has the below procedure. Basically a procedure to called a stored procedure and return the results. When I try to call the webservice from my program I get the error. Both...
6
by: AMP | last post by:
Hello, First, Thanks for ALL your help. Second, another question: I have some c code i am turning into c#:(truncated) WORD calcChecksum(BYTE data, WORD length) /* Calculates a checksum of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.