Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    11
    Views
    151

    Why are you generating the random integer 20...

    Why are you generating the random integer 20 times, overwriting it each time except the last? You only need to generate it once, although I'm guessing you want the for loop to include more than just...
  2. Replies
    11
    Views
    151

    It looks like you still have that semi-colon...

    It looks like you still have that semi-colon terminating the for loop early. You need to use braces to mark the body of the for loop because it consists of more than one statement.
  3. Replies
    11
    Views
    151

    What is your current code? Post it within code...

    What is your current code? Post it within code tags.
  4. Replies
    11
    Views
    212

    The formal names are "lvalue reference" and...

    The formal names are "lvalue reference" and "rvalue reference" :)

    Universal references don't exist in the semantics of C++, but rather is useful to refer to syntax involving && with some deduced...
  5. Replies
    2
    Views
    134

    If we exclude possible implementation-specific...

    If we exclude possible implementation-specific bugs, no.
  6. Replies
    11
    Views
    212

    Unfortunately the formerly best book for learning...

    Unfortunately the formerly best book for learning standard C++, Accelerated C++, is indeed an old book that hasn't been updated by Koenig and Moo for C++11. That said, if it's available at your local...
  7. Replies
    7
    Views
    353

    What's the reason behind the doubled parentheses?...

    What's the reason behind the doubled parentheses? It doesn't look like there's a precedence pitfall to avoid.
  8. Replies
    3
    Views
    217

    Can't you change the main program to open the...

    Can't you change the main program to open the file, read and store the data, and then pass it to UMAT on each call?


    Yes, that is what I mean, assuming you only need an int rather than some...
  9. Replies
    4
    Views
    260

    It might be helpful to understand typedefs the...

    It might be helpful to understand typedefs the way the standard sees them: a typedef is a declaration of identifiers that has the storage class specifier of typedef. So you should ask yourself, what...
  10. Replies
    3
    Views
    217

    By "user subroutine" do you mean "function"? That...

    By "user subroutine" do you mean "function"? That would be the standard term in C.

    If so, it sounds like you should open the file in the calling function. If you cannot do that, then you might...
  11. That's only true if you know for sure that the...

    That's only true if you know for sure that the input ends in digits only.


    If you want to print to standard output, printf is fine. It was your use of it that was problematic. You could have...
  12. It's not just a security issue, it's a potential...

    It's not just a security issue, it's a potential bug even under normal usage by a trusted user: if the string accidentally is constructed to contain a format specification, the behaviour is then...
  13. I was thinking along the lines of: char...

    I was thinking along the lines of:

    char *extract_consecutive_digits(const char *input, char *output, size_t output_size)
    {
    const char *digits = input + strcspn(input, "0123456789");
    ...
  14. Write a function to extract the digits in a...

    Write a function to extract the digits in a string. Test it. After you are sure, you can then use this function on the lines of your text file by reading them as strings.
  15. As per rstanley's firm insistence, please stick...

    As per rstanley's firm insistence, please stick to standard C, and hence ignore flp1969's post #2. Both poll and select are non-standard with respect to C11.

    Besides Click_here's mention about EOF...
  16. Replies
    10
    Views
    424

    I didn't suggest using system; I suggested using...

    I didn't suggest using system; I suggested using sed. There is no need to write a C program that calls system to invoke sed. Just invoke sed. If you do have other things to do that would be...
  17. I'm inclined to count the number of 0s (call this...

    I'm inclined to count the number of 0s (call this N), then count the number of 1s (call this M) in the first N elements of the array. M is the minimum number of swaps required. This is more of an...
  18. Replies
    10
    Views
    424

    Yes. However, instead of doing this in C, you...

    Yes. However, instead of doing this in C, you might want to do this using sed if it is available.
  19. Replies
    3
    Views
    250

    Is there any code that you aren't showing us? Put...

    Is there any code that you aren't showing us? Put it another way: is this the entire content of the main function?
  20. I believe the tag namespace is separate, so...

    I believe the tag namespace is separate, so struct cgraph_node would not conflict with a function named cgraph_node. On the other hand, perhaps it would be a better idea to use a different function...
  21. Replies
    1
    Views
    113

    Instead of trying to do early detection, accept...

    Instead of trying to do early detection, accept that disk failures happen and so get a NAS or cloud storage and auto-backup to it.
  22. Replies
    2
    Views
    222

    I use my B&W laser printer once every couple of...

    I use my B&W laser printer once every couple of months with no toner issues.
  23. Replies
    3
    Views
    399

    That would be true if ptr is pointing to the...

    That would be true if ptr is pointing to the first element (as in index 0) of buffer (since you would then effectively have buffer - buffer, which is 0), but that may not be the case. Hence, pos...
  24. You already posted about this. *thread closed*

    You already posted about this.

    *thread closed*
  25. Replies
    5
    Views
    410

    You should be aware that while it is conventional...

    You should be aware that while it is conventional to say that a byte is 8 bits, in C the number of bits in a byte is denoted by CHAR_BIT, and while it must be at least 8, it could be larger.

    ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4