I am writing a decryption class (AES/CBC/PKCS7Padding) where the encrypted data is coming from C#. I want to take the following string (which is base64 encoded):
usiTyri3/gPJJ0F6Kj9qYL0w/zXiUAEcslUH6/zVIjs=
and convert it to a byte array in java to pass into the SecretKeySpec as the key. I know there is the issue of C# having unsigned ...
The C standard states:
ISO/IEC 9899:1999, 6.2.5.15 (p. 49)
The three types char, signed char, and
unsigned char are collectively called
the character types. The
implementation shall define char to
have the same range, representation,
and behavior as either signed char or
unsigned char.
And indeed gcc define that accord...
I want to increment an unsigned integer from multiple threads.
I know about Interlocked.Increment, but it does not handle unsigned integers. I could use lock(), but I would rather not if possible for performance reasons.
Is it thread safe just to increment it in the normal way? It would not matter if the occasional increment got lost,...
Suppose I have this (C++ or maybe C) code:
vector<int> my_vector;
for (int i = 0; i < my_vector.size(); i++) {
my_vector[i] = 0;
}
I don't care if it's done right. The important part is in the for-loop declaration.
The compiler gives a signed/unsigned mismatch for this, since size() returns an unsigned int, not a signed one. How i...
I have a windows mobile app (mymobiler) that i am trying to install and run in my windows mobile phone. As soon as it gets installed it prompts the user with Yes/No option whether to let the program run in the device.
Is there anyway to by pass this? I understand this is just one time , but i just want to know whether if i can avoid th...
Hello,
I have a string in PHP (came from some data source), which represents a formatted unsigned 32-bit integer.
I need to store it into a MySQL database as a signed 32-bit integer, so that later I can retrieve it from PHP and use it as a (possibly negative) signed integer constant (since PHP doesn't have unsigned integers).
So, what ...
I've seen this unsigned "typeless" type used a couple of times, but never seen an explanation for it. I suppose there's a corresponding signed type. Here's an example:
static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int myrand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
v...
For example, I have a dependency property that changes the ScaleTransform of a Canvas, but if it ever goes below zero it throws an error. Sure, I could just force it to zero in the code if that ever happens, but I'd rather use a better method like using a udouble (unsigned double), which doesn't exist in Silverlight or even setting the m...
I understand the difference between unsigned char * and char * types. I also understand how to use reinterpret_cast to cast an unsigned char * to a char * in C++.
I'm using sqlite3 in Objective-C and am trying to get an NSString from a call to
sqlite3_column_text(...);
To do this, I'm basically doing:
char *cParam = (char *)sqlite...
I'm dealing with some code at work that includes an expression of the form
-(sizeof(struct foo))
i.e. the negation of a size_t, and I'm unclear on what the C and C++ standards require of compilers when they see this. Specifically, from looking around here and elsewhere, sizeof returns an unsigned integral value of type size_t. I can'...
Hi,
Here is a code that I copied from the web
/**
* A simple example that uses HttpClient to perform a GET using Basic
* Authentication. Can be run standalone without parameters.
*
* You need to have JSSE on your classpath for JDK prior to 1.4
*
* @author Michael Becke
*/
public class BasicAuthenticationExample {
/**
...
Hey,
I'm trying to read unsigned integers from a file (stored as consecutive byte) and convert them to Integers. I've tried this:
file = File.new(filename,"r")
num = file.read(2).unpack("S") #read an unsigned short
puts num #value will be less than expected
What am I doing wrong here?
Cheers,
Pete
...
In c++ you can do:
uint8 foo_bar
How would we do the same thing in ruby? Any alternatives?
This post seems close to it maybe someone can explain?
...
Hi
I am trying to convert char *str = "10.20.30.40" ; in to unsigned int . can u pls tell me any method is there or any sample code . pls share me.
...
What is the C equivalent of Convert.ToInt16(String) method of C#?
In my case my string is a char array.
Thanks
...
If lv stores a long value, and the machine is 32 bits, the following code:
iv = int(lv & 0xffffffff)
results an iv of type long, instead of the machine's int.
How can I get the (signed) int value in this case?
...
How do I put the value of 0x04 in register 4 if the instruction was 1rxy?
1RXY-Load register R with the value at memory address XY
#include <stdio.h>
unsigned char r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,ra,rb,rc,rd,re,rf;
void reg_check(unsigned char reg);
void rxy1(unsigned char reg, unsigned char val);
int main(){
unsigned char memloc1=...
What's the safest and best way to retrieve an unsigned long from a string in C++?
I know of a number of possible methods.
First, converting a signed long taken from atol.
char *myStr; // Initalized to some value somehow.
unsigned long n = ((unsigned)atol(myStr));
The obvious problem with this is, what happens when the value stored i...
Here is the code:
echo sprintf('%u',-123);
And this is the output on 32 bit platform:
4294967173
but on 64 bit:
18446744073709551493
How to make it the same ?Say,the int(10) unsigned
...
Hello,
Is there a way in Java to use Unsigned numbers like in (My)SQL?
For example: I want to use an 8-bit variable (byte) with a range like: 0 -> 256; instead of -128 -> 127.
...