Questions tagged [uint32-t]

uint32_t is 32-bit unsigned integer type. To get this type in your program include or . (corresponding C++ files if you want these types in a C++ code)

Use PRIu32 and SCNu32 to print and scanf this type.

73 questions
0
votes
2 answers

unsigned long and uint32_t?

I'm studying socket programming and I learned inet_addr function. But I'm confused how can I handle in_addr_t type. inet_addr function returns in_addr_t type which is uint32_t, then do I have to use uint32_t type variable to handle it? In the book,…
coder
  • 95
  • 1
  • 1
  • 5
0
votes
0 answers

Cast int to unsigned int c++

What is the best casting method to use when casting int to uint32_t? Should I use (uint32_t)num, or reinterpret_cast(num), or static_cast(num)? (Or something else)? I know that there are many explanations out there regards the…
ElyashivLavi
  • 1,681
  • 3
  • 22
  • 33
0
votes
0 answers

Back to a 2013 project, I have a lot of "type u_int32_t could not be resolved"

I compiled my project in 2013 with g++ v. 4.7.3 under Gentoo Linux and Eclipse Indigo with c++11. In this project, I need integer size perfectly defined. So, I used u_int32_t, u_int8_t types. Today, I have g++ v. 4.9.2 under Debian Jessie, still…
lalebarde
  • 1,684
  • 1
  • 21
  • 36
0
votes
4 answers

How to print uint32_t variables value via wprintf function?

It is a well-known fact that to print values of variables that type is one of fixed width integer types (like uint32_t) you need to include cinttypes (in C++) or inttypes.h (in C) header file and to use format specifiers macros like PRIu32. But how…
Constructor
  • 7,273
  • 2
  • 24
  • 66
0
votes
2 answers

How to iterate through arrays to copy them into another array of type uint32_t?

I have created a C program that consists of an integer array structure states[2] . I also need a uint32_t type array called store. I just want to copy the contents of the array states[0] into store[0] and the contents of states[1] into store[1]. I…
Goldengirl
  • 957
  • 4
  • 10
  • 30
0
votes
1 answer

storing data on a buffer on c++

I have a simple function on c++ which takes 2 arguments: read(uint32_t *buffer, uint32_t num_words){ ... } When I try to call it I get an error because the arguments I pass are probably wrong unsigned long*, unsigned long: uint32_t addr =…
matt
  • 2,312
  • 5
  • 34
  • 57
0
votes
7 answers

How to convert comma separated char* to uint32_t[] array in C

I want to convert a comma separated char* to an uint32_array[] in C. Is there an easy method/routine to do that? I already spend a lot of time on SO and found many solutions on C++, but not an C like that : Parsing a comma-delimited std::string But…
frank schmidt
  • 121
  • 3
  • 15
0
votes
1 answer

Converting a character array to be handled as a hex in C

I've just recently been required to work with C—I normally work with Python and a bit of Java—and I've been running into some issues. I created a function that converts a base-10 unsigned int into a character array that represents the equivalent…
IronMage
  • 41
  • 7
0
votes
3 answers

casting a constant to be used as a pointer

I've been using some example code that runs in an ARM processor. To read a specific memory location it casts a constant value to an address. For example: We want to read a memory value at 0xa0000000 The example code is like this: uint32_t…
0
votes
1 answer

How to store a struct member as big endian

I have a struct similar to: typedef struct _pair_t{ uint16_t keylen; // 2 uint32_t vallen; // 4 } __attribute__((__packed__)) pair_t; I will be using mmap to read from a file, so I want to store the numbers as big endian. Do I…
Nick
  • 9,962
  • 4
  • 42
  • 80
0
votes
1 answer

Passing an array of uint32_t uids via adafruit BTLE

I have an arduino sketch, that listens for RFID tags, and gets their uid's and stores them in an array of uint32_t This is an arduino_uno project with an adaFruit BTLE and as adafruit NFC/RFID Shield The array is initiated like so: uint32_t…
erik
  • 4,946
  • 13
  • 70
  • 120
0
votes
3 answers

Reversibly Combining Two uint32_t's Without Changing Datatype

Here's my issue: I need to pass back two uint32_t's via a single uint32_t (because of how the API is set up...). I can hard code whatever other values I need to reverse the operation, but the parameter passed between functions needs to stay a…
Chance
  • 988
  • 2
  • 13
  • 29
0
votes
2 answers

Bit sign of uint32_t -1 instead of 1 in C

I have done uint32_t bits= 0; bits |= 1<< 31; and then using void printbits(uint32_t n) { if (n) { printbits(n >> 1); printf("%d", n & 1); } } on bits I get 10000000000000000000000000000000, which is what I want, but when…
codeoverflow
  • 143
  • 2
  • 12
0
votes
3 answers

Quickly Converting uint32_t to binary

The main problem I'm having is to read out values in binary in C++ (python had some really quick/easy functions to do this) I just need the same. So at the moment I have: ValWord< uint32_t> data1=//[SOME READ FUNCTION] When I use cout << data1; It…
fiz
  • 906
  • 3
  • 14
  • 38
0
votes
1 answer

c convert uint32_t casted to int32 saved to file and read the uint32_t agein

I have made a C program to log some data. I get a timestamp in uint32_t format. I then saved the data using afprintf("%d",timestamp) this means that it made a cast from the unsigned integer to an signed integer, and therefore i got some numbers…
pjensen68321
  • 521
  • 1
  • 5
  • 15