Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds; generated 44 minute(s) ago.

  1. 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.
  2. 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.
  3. 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...
  4. 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...
  5. 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).

    ...
  6. 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...
  7. 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...
  8. Can you construct a complete (runnable) minimal...

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

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

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

    What kind of checksum are you looking to...

    What kind of checksum are you looking to calculate?
  11. Replies
    35
    Views
    917

    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...
  12. 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...
  13. Replies
    5
    Views
    322

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

    Push whatever values you want. I just used a counting loop.
  14. Replies
    5
    Views
    322

    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) {
  15. 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
    *...
  16. Replies
    5
    Views
    439

    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...
  17. 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); ...
  18. You need to set stdout to binary mode. On Windows...

    You need to set stdout to binary mode. On Windows in text mode an output stream automatically writes a '\r' before every '\n'; an input stream in text mode ignores a '\r' before a '\n'. Binary mode...
  19. Since rand() returns an int, obviously RAND_MAX,...

    Since rand() returns an int, obviously RAND_MAX, "the maximum value returned by the function rand," cannot be UINT_MAX.

    Also, double's only have a precision of 15-17 decimal digits, so showing...
  20. Another possibility. Generates values from...

    Another possibility. Generates values from -0.999999999068677 to 0.999999999068677, inclusive.


    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>

    double rndx()
    {
    return...
  21. Replies
    2
    Views
    680

    A lot of problems. To name a few: 1. You are...

    A lot of problems. To name a few:
    1. You are only allocating space for a single song.
    2. One of the songs is missing the year.
    3. You need to check that argc is 2 BEFORE you access argv[1].
    4. In...
  22. Replies
    4
    Views
    768

    A quick and dirty example. Consider this...

    A quick and dirty example.


    Consider this directory structure, where w, x, y, z are text files containing
    "w data", "x data", etc:

    a
    ├── b
    │ ├── w
    │ └── x
  23. Replies
    8
    Views
    645

    Sure. #include #include...

    Sure.


    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>

    #define READ(f, var) fread(&(var), sizeof(var), 1, (f))

    typedef struct ElfHeader {
  24. Replies
    10
    Views
    1,287

    Write code that makes sense.

    Write code that makes sense.
  25. Replies
    8
    Views
    645

    On the wikipedia page it shows that there are...

    On the wikipedia page it shows that there are different sizes of some of the values depending on whether it's 32 or 64 bits. For instance, obviously the entry point can't be 32 bits on a 64 bit...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4