Search:

Type: Posts; User: mondaytofriday

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Just a quick one - getting unexpected result for bitwise AND

    My code:


    Primitive<uint64_t> full = 0xBBBBBBBBCCCCCCCC;
    Primitive<uint64_t> first = 0x0000000000000000;
    first = (full & 0xFFFFFFFE00000000);
    std::cout << "FIRST: " << first << std::endl;

    ...
  2. thanks!

    thanks!
  3. saving specific bits from a 64-bit number

    Hello,

    I have a 64-bit uint64_t number:


    Primitive<uint64_t> b = 0xCCCCCCCC00000000;

    I need to save the first 31 (most important) bits - 7FFFFFFE.

    I found this solution in the Internet:
  4. Replies
    15
    Views
    2,276

    I think I got it sorted now :) thanks anyway.

    I think I got it sorted now :) thanks anyway.
  5. Replies
    15
    Views
    2,276

    I do use printf in other places, just prefer...

    I do use printf in other places, just prefer std::cout for temporary logging as I used to use it in my happy C++ days :)
  6. Replies
    15
    Views
    2,276

    Well I can use things like std::cout in my code...

    Well I can use things like std::cout in my code for now, but will need to remove them later for the final build, as the final product will need to run on a C-only system.
  7. Replies
    15
    Views
    2,276

    What would I do then in this case: char*...

    What would I do then in this case:


    char* endText;
    endText = strstr(*objectData2, " 5000");

    I don't know how long endText would be, but I need to append '\0' to the end of it. I was going to...
  8. Replies
    15
    Views
    2,276

    this is C with some C++ functionality...

    this is C with some C++ functionality...
  9. Replies
    15
    Views
    2,276

    oh! gotcha :) thanks

    oh! gotcha :) thanks
  10. Replies
    15
    Views
    2,276

    oh right.... isn't appending a null character the...

    oh right.... isn't appending a null character the same as strcat-int an empty string?
  11. Replies
    15
    Views
    2,276

    oh... didn't realise I had to do it as I was...

    oh... didn't realise I had to do it as I was using all 6 chars in it, I thought all the rubbish in the startText would be overwritten...

    but yes, this sorted the problem:


    for (int i = 0; i <...
  12. Replies
    15
    Views
    2,276

    Getting strange output!

    Could someone explain to me what is going on here? Why does this code:


    char[6] startText;

    char data[] = "1.1\nWord\nWord\n0-5\n\0";
    char* dataPtr = data;
    char** objectData2 = &dataPtr;
  13. Oh! I didn't realise I could do it this way:...

    Oh! I didn't realise I could do it this way: std::sscanf(*objectData, "%*f %*s %*s %d - %d", &num1, &num2);
    This seemed to work!
  14. right... I've been reading about sscanf and...

    right... I've been reading about sscanf and sprintf, and it does look like it's what I need, but at the moment I am getting strange results.

    here is an example:

    *objectData is:

    ...
  15. Thanks, ill give it a try... But so far I find c...

    Thanks, ill give it a try... But so far I find c string functions really difficult - always give weird results and it takes ages to recompile and retest in my environment
  16. Help with swapping some numbers in a C-string (sorry - again)

    Problem:
    I have a pointer to a pointer to a C string:

    char **objectData;

    In this string there are some numbers with a dash between them, for example, "5-10". I need to read these numbers in...
  17. Yes, thanks :)

    Yes, thanks :)
  18. Sorry, completely forgot about strcpy :) Works!

    Sorry, completely forgot about strcpy :) Works!
  19. changing the value of a string through a pointer

    Basically, I have a pointer to a C string:


    char **objectData

    and a C string:


    char temp[350];
  20. Replies
    14
    Views
    1,998

    Sorry ignore the /r problem - I was logging...

    Sorry ignore the /r problem - I was logging incorrectly. /r exist in the original data as well.
  21. Replies
    14
    Views
    1,998

    Meanwhile, I think I found the problem. I...

    Meanwhile, I think I found the problem.

    I printed out the original objectData and the new objectData character by character. The original data contains new line characters. They also exist in the...
  22. Replies
    14
    Views
    1,998

    Thanks. I'll explore this.

    Thanks. I'll explore this.
  23. Replies
    14
    Views
    1,998

    Yes, I do :) thank you

    Yes, I do :) thank you
  24. Replies
    14
    Views
    1,998

    Maybe I should append a null character then? I'll...

    Maybe I should append a null character then? I'll try this as well.

    I started writing my own for loop to read through the data, and am getting a silly problem - how do I access the characters??...
  25. Replies
    14
    Views
    1,998

    Ah, strlen. I'll try this, thanks. I'm...

    Ah, strlen. I'll try this, thanks.

    I'm inserting the text somewhere in the middle and only once in the function. But I guess doing it manually might be an option as I do get some rubbish in the...
Results 1 to 25 of 27
Page 1 of 2 1 2