Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    2
    Views
    81

    Nothing is happening. Your machine (our common...

    Nothing is happening.
    Your machine (our common Intel/AMD machines) are little endian.
    So the value 0xd8754a52 is stored in memory with the "little end" (least significant byte) "first" (lowest) in...
  2. "Conversion loses qualifiers" suggests that the...

    "Conversion loses qualifiers" suggests that the "const" is causing the difference.
  3. Replies
    1
    Views
    69

    Well, "triangle" has an 'n' in it. And you...

    Well, "triangle" has an 'n' in it.
    And you aren't storing "points" but side lengths.
    Also, the exercise says to pass a triangle to the function, not it's separate side lengths.
  4. Replies
    2
    Views
    94

    Maybe something like this. I couldn't test it...

    Maybe something like this. I couldn't test it since you didn't give me a full program. I'm assuming "index_stock" is what might better be called stock_size, the current number of active elements in...
  5. Replies
    8
    Views
    138

    That's the difference between "text" and "binary"...

    That's the difference between "text" and "binary" modes in both C and C++.
    In text mode, the '\r' chars are removed.
    In binary mode they aren't.
    The OP's problem counting newlines had to do with...
  6. Replies
    8
    Views
    138

    No, '\n' is not "twice as large". The problem is...

    No, '\n' is not "twice as large".
    The problem is that you are reading a file with Windows line endings ('\r' '\n') in text mode, so your fread will never see the '\r' characters.
    However, the fseek...
  7. Replies
    15
    Views
    250

    You seem to want to do something like the...

    You seem to want to do something like the following. Note that you can keep the question and answer together in a struct and then have an array of those structs. Also, the sizeof trick for...
  8. GetTextMetrics...

    GetTextMetrics has nothing to do with C++. It's a Windows API function that would appear to do what you want. Is your program a Windows GUI program?
  9. No, UDP is "unreliable". It's used for higher...

    No, UDP is "unreliable". It's used for higher performance. It will not necessarily get the packets to you and when packets do arrive they may be out of order.
  10. I think if your underlying protocol is TCP then...

    I think if your underlying protocol is TCP then you should receive all your messages, in the correct order.
  11. Maybe you need to do something like this: ...

    Maybe you need to do something like this:


    void print_string(const char *str)
    {
    for (const char *s = str, *end = str + strlen(str); s != end; )
    {
    if...
  12. It's not "premature optimization", just a...

    It's not "premature optimization", just a different algorithm. But I agree that it's too complicated for this. There's only a million 6 digit numbers so you could just loop from 0 to a million and...
  13. Take the current loop indices, create an array...

    Take the current loop indices, create an array from them and use, e.g., Heap's algorithm to generate the permutations (not "combinations", which is what we are generating with the loops).

    ...
  14. I don't think this is a task for backtracking....

    I don't think this is a task for backtracking. For instance, to generate all 3-combos of the numbers 0,1,2,3,4:


    for (int a = 0; a < 3; ++a)
    for (int b = a + 1; b < 4; ++b)
    for...
  15. Now that I think about it, by the time the body...

    Now that I think about it, by the time the body of the ctor starts to run,
    all the default value, default ctors, and initialization list members have run.
    So it's complaining about...
  16. Can you construct a complete (runnable) minimal...

    Can you construct a complete (runnable) minimal example?
    Doing so in itself may reveal the problem.
  17. Replies
    35
    Views
    984

    mp3 files can have id3 (v1 and v2) tags which...

    mp3 files can have id3 (v1 and v2) tags which contain metadata.
  18. Replies
    35
    Views
    984

    What kind of checksum are you looking to...

    What kind of checksum are you looking to calculate?
  19. Replies
    35
    Views
    984

    Reading the files is the likely bottleneck of...

    Reading the files is the likely bottleneck of your program. I don't see how you can speed that up much since you want to process them each through once. I would try something simple like below. Let...
  20. int main() { struct bucket...

    int main()
    {
    struct bucket bucketlist[buckets_per_frame];

    for ( int i=0 ; i<buckets_per_frame ; i++ )
    {
    bucketlist[i].buffer = malloc(pixels_per_bucket * sizeof(struct...
  21. Replies
    5
    Views
    343

    Push whatever values you want. I just used a...

    Push whatever values you want. I just used a counting loop.
  22. Replies
    5
    Views
    343

    Maybe: #include void push(int...

    Maybe:


    #include <stdio.h>

    void push(int *a, int *size, int value) {
    a[(*size)++] = value;
    }

    void print(const int *a, int size) {
  23. How about Chapter 30. Boost.Process - 1.76.0...

    How about Chapter 30. Boost.Process - 1.76.0

    Quote:
    Boost.Process is a library to manage system processes. It can be used to:
    * create child processes
    * setup streams for child processes
    *...
  24. Replies
    5
    Views
    465

    Couldn't you just store the strings reversed? ...

    Couldn't you just store the strings reversed?

    We can only determine the best way to speed up your program if you specify the entire thing. For instance if there's a reasonable fixed number of...
  25. Your append function cannot modify main's local...

    Your append function cannot modify main's local copy of head.
    Also, your getLast always returns NULL.

    For append, you can return head from it and call it like:


    head = append(head, id); ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4