-1

I have the below code

unsigned int headerbytes = 0U;
    headerbytes = (unsigned int*)strtoull(packet_space->header, NULL, 0);

    packetHeader header = deconstructPacketHeader((&headerbytes));

packet_space is a char[], basically its a 4byte char array that I want to convert to a unsigned int. deconstructPacketHeader() takes an unsigned int, but stroutll (With my cast) is returning a double pointer. basically, how do I get the actual value of the uint (dereference twice) so I can pass it do deconstructPacketHeader() ?

Thanks!

will
  • 1,397
  • 5
  • 23
  • 44
  • If `packet_space` is a `char[]`, how can `packet_space->header` be a valid term? – glglgl Apr 24 '13 at 17:25
  • BTW: I don't know what strange `strtoull()` you have, but the [standard one](http://linux.die.net/man/3/strtoull) returns a `unsigned long long int`. – glglgl Apr 24 '13 at 17:27
  • Assigning an `unsigned int *` to `unsigned int`??? – shinkou Apr 24 '13 at 17:27
  • What are the contents of packet_space->header? Does it contain a null-terminated string with the textual representation of a number, or does it contain a four-byte integer obtained by reading from a network stream (or from a file) ? – This isn't my real name Apr 24 '13 at 17:35

1 Answers1

1

Probably you think too complicated.

Try

unsigned long long headerbytes = 0ULL;
headerbytes = strtoull(packet_space->header, NULL, 0);
packetHeader header = deconstructPacketHeader(headerbytes);
glglgl
  • 89,107
  • 13
  • 149
  • 217