Skip to main content

All Questions

Tagged with
0 votes
1 answer
74 views

Reading dynamic sized byte arrays as integers [duplicate]

I have a binary file which has a header determining the length of each data element in the file. For example byte length of 2, 4 or 8 etc. How to define to a function that's output can be a vector of ...
vahvero's user avatar
  • 663
2 votes
2 answers
72 views

go lang: view []uint32 array as []uint8

what is the most efficient way in Go to view uint32 array as uint8 array? for now my solution in go is quite clumsy and involves a lot of unnecessary binary arithmetic: import "fmt" func ...
Daniil Zuev's user avatar
0 votes
4 answers
132 views

How to directly cast array of Objects to array of Integer without modifications

I have an Objects array filled up with Strings: Object[] array = new Object[count]; for (int i = 0; i < array.length; i++) { array[i] = String.valueOf(i); } Then I refill it with Integers: for (...
Max Trunnikov's user avatar
0 votes
2 answers
74 views

func argument with an Array of mixed types (protocol), then call a static method of the protocol

Here are my structures (I can have lot more, that why I need a generic way to do with MyProtocol): protocol MyCustomCodable { static func buildQuery() } struct A: MyCustomCodable { ... } ...
Guillaume PELOUAS's user avatar
1 vote
0 answers
83 views

Does InstrB convert byte arrays to string and then search or does it use the byte array provided in VBA?

Microsoft Documentation If you use a byte array as an input parameter does VBA cast it to a string and create its own array or does it use the one provided? Function NextOpen (byteA() as byte,...
user8045502's user avatar
0 votes
1 answer
49 views

Why does casting the value to a string change the behavior of the code in rewriting array values?

I'm encountering an issue while attempting to update values within an array. Specifically, this portion of my code seems problematic: $response["rates"][$key[$i]] = (string) round($response[&...
Voha's user avatar
  • 1
1 vote
2 answers
91 views

c# casting array of bytes to array of structures

I have this code in c# where I need copy array of bytes to array of structures in the fastest way. I have this structure: [StructLayout(LayoutKind.Sequential, Pack = 1)] unsafe public struct ...
jirikk's user avatar
  • 19
0 votes
0 answers
68 views

Define an array of enum values and change that values

I would like to assign the values of an enum to an array of that enum type but I keep getting a warning that says "format '%d' expects argument of type 'int *', but argument 2 has type tShipType *...
BBoss's user avatar
  • 1
4 votes
1 answer
112 views

Java: Casting Object to primitive array using Class.cast()

Casting a known primitive array masquerading as an Object back to it's original primitive array type using the Class.cast method involves breaking the operation up into two assignments first before it'...
JNellis's user avatar
  • 53
0 votes
2 answers
346 views

combine two uint8 into one uint16

I have an array in bytes, content is camera frame 480x640 x 2 bytes per pixel raw = np.asarray (d.GetFrameData ( ), dtype=np.uint8) print (raw, raw.shape, type(raw))` print output is below, 614400=...
Edward Pang's user avatar
0 votes
1 answer
59 views

Why does one method of adding all the elements of an array fail when similar methods succeed [closed]

I have an array of doubles. To simplify the example, I use an array of length 3. I want to add all 3 elements of the array. I do it in 3 ways. Here's the program to demonstrate. #include <stdio.h&...
rkg125's user avatar
  • 61
0 votes
0 answers
39 views

Casting from string array to object array in C# [duplicate]

In this C# lesson from Microsoft, they discuss various types of exceptions. When discussing ArrayTypeMismatchException, they provide the following example: string[] names = { "Dog", "...
Gaussler's user avatar
-2 votes
1 answer
50 views

Why Do I Need to Cast Int To A Double Variable In A Print Statement If Its Already Declared/Initialized As A Double? [duplicate]

I am trying to traverse an array in Java via a for loop, but for some reason it will only print the doubles in my list if I cast 'int'. Otherwise I get a "Type Mismatch: cannot convert double to ...
A_Pickle's user avatar
2 votes
2 answers
111 views

Casting an array of standard-layout objects to array of elements

In C++, it is legal to reinterpret_cast a pointer to a standard-layout type S to a pointer to any of the members of S, possibly using the offsetof macro. If S only has one member, then offsetof is not ...
Arek' Fu's user avatar
  • 857
0 votes
1 answer
71 views

Casting from int array to char pointer in C

int v_1[10] = { -1,1000,2 }; int a; a = strlen(((char*)v_1 + 1)); I'm having trouble understanding why the 'a' variable is equal to 5 in this particular case. I'm also struggling to grasp the ...
Sako's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
57