Hi,
I had been doing some file IO in a project i am currently working on and so far I have been reading in a whole block of data using the following fast and convenient method:
struct Header { ... };
class Data { ... };
// note that I have not used compiler directives to pack/align/order bytes
// partly because I don't know how to.
He...
I'm trying to create an array of bytes whose length is UInt32.MaxValue. This array is essentially a small(ish) in-memory database:
byte[] countryCodes = new byte[UInt32.MaxValue];
On my machine, however, at run-time, I get a System.OverflowException with "Arithmetic operation resulted in an overflow".
What's the deal? Do I need to us...
Is there a better way to write this than using BitConverter?
public static class ByteArrayExtensions
{
public static int IntFromUInt24(this byte[] bytes)
{
if (bytes == null)
{
throw new ArgumentNullException();
}
if (bytes.Length != 3)
{
throw new ArgumentOutOfRa...
Why does the following call:
printf("%d %d", 'a', 'b');
result in the "correct" 97 98 values?
%d indicates the function has to read 4 bytes of data, and printf shouldn't be able to tell the type of the received arguments (besides the format string), so why isn't the printed number |a||b||junk||junk|?
Thanks in advance.
...
So Say I have an array of bytes that is 16 long, with each 8 bits representing my data and an array that is 8 long with each 4 bits (so 2 per byte) representing my data.
If I wanted to loop over these and get the values, what would be the easiest way of doing so?
My poor attempt would be something like this, but this doesn't appear to ...
Hello experts,
can anyone tell me below string how much bytes will take?
string abc = "a";
Thanks in advance:)
...
How do I get my byte array to a string that handles the Swedish letters å ä ö?
I do this at the moment:
NSString *hexString = [NSString stringWithFormat:@"%c", resData[i]];
(resData contains ascii characters)
But when I use the hexString in my output label I get jibberish for all non English chars.
How can I make a selected byte to an ...
Hi,
I have the following loop.
for(byte i = 0 ; i < 128; i++){
System.out.println(i + 1 + " " + name);
}
When I execute my programm it prints all numbers from -128 to 127 in a loop. But the loop
seems to be endless. Any ideas?
...
I'm reading binary data from a file, specifically from a zip file. (To know more about the zip format structure see http://en.wikipedia.org/wiki/ZIP_%28file_format%29)
I've created a struct that stores the data:
typedef struct {
/*Start Size Description ...
I'm trying to write a ROM file patcher and I came to this in the documentation:
The next three bytes are the place in the destination file
(the file to be patched) where a change is to be made.
The two bytes following that are the length of the amount
of data to be changed.
How would I turn those three and two bytes into a single num...
alright, so my code to read bytes into a int is like so:
int offset = (byte << 16) | (byte2 << 8) | byte3;
And it's reading the bytes "00 00 be" as -66.
How do I read it as the 190 it's meant to be?
...
I am working on making my client open another program by downloading the bytes and using reflection to open it. I have currently got this working on a C# Console Application, but when I try and do it on a Windows Form Application I get this error.
"Exception has been thrown by the target of an invocation."
Here is the code
using Syste...
Hello everyone,
Is there any way I can convert the value of a [NSData bytes] to a float so that I can add it to a progress bar?
Thanks,
Kevin
...
So java has a long type suffix for literals: (123L), a double type suffix (43.21D), a floating point suffix (1.234F). So ... why no byte type suffix? For example, when writing some testing code you MUST cast all your bytes when they are used as function parameters.
ByteBuffer b = ByteBuffer.allocate(100);
b.put((byte)3); // super an...