Thread: Converting Hex to Decimal (strtol) not working?

  1. #16
    Registered User
    Join Date
    Apr 2012
    Posts
    14
    I am getting an error during the calculation of "n"?? For the;

    Code:
    n=(int*)Posn;
    
    and
    
    n=(int *)Posn;

    I am seeing an error "a value of type "int *" cannot be assigned to an entity of type "int" ?? Any ideas?

  2. #17
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    n is an int, so obviously you can't assign an int* to it. You might try n = *(int*)Posn, but as has already been pointed out, there may be alignment problems since, for example, a 4-byte int often needs to begin on a 4-byte boundary, whereas a char array could possibly begin anywhere. You could try the enum idea to ensure proper alignment.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting decimal to binary
    By BrandNewDeipz in forum C Programming
    Replies: 4
    Last Post: 03-03-2012, 09:34 AM
  2. Converting Decimal to Binary
    By BeldenML in forum C Programming
    Replies: 17
    Last Post: 02-09-2012, 11:29 AM
  3. Converting decimal to binary
    By ubernos in forum C Programming
    Replies: 3
    Last Post: 12-06-2005, 10:09 AM
  4. Converting decimal to hex
    By cobrakidd in forum C++ Programming
    Replies: 9
    Last Post: 02-06-2003, 11:37 AM
  5. converting a hex number to decimal???
    By Unregistered in forum Game Programming
    Replies: 8
    Last Post: 04-13-2002, 05:46 PM

Tags for this Thread