Search:

Type: Posts; User: hashbang

Search: Search took 0.00 seconds.

  1. Replies
    12
    Views
    1,425

    that works. Thanks. I thought atoi would be...

    that works. Thanks. I thought atoi would be needed after storing it in the char *.
  2. Replies
    12
    Views
    1,425

    you might be right as it does not seem too work.

    you might be right as it does not seem too work.
  3. Replies
    12
    Views
    1,425

    ah... memcpy(&a,foo,4);

    ah...


    memcpy(&a,foo,4);
  4. Replies
    12
    Views
    1,425

    Yes it does, but I am not sure what I am missing.

    Yes it does, but I am not sure what I am missing.
  5. Replies
    12
    Views
    1,425

    So using malloc should work? The actuall pinter...

    So using malloc should work? The actuall pinter is malloc'd memory.

    int a,b;
    char *foo = malloc(sizeof(char) * 100);
    int num = 123456;
    memcpy(foo,&num,4);

    ...
  6. Replies
    12
    Views
    1,425

    int to char and back

    Hi,

    I'm trying to add a int to the first four bytes of a char * and then later on I have to extract the int from the char *.
    Example

    char *foo = " number";
    int num = 123456;...
Results 1 to 6 of 6