Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    3
    Views
    121

    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...
  2. 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); ...
  3. 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...
  4. 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...
  5. 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...
  6. Replies
    2
    Views
    523

    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...
  7. Replies
    4
    Views
    597

    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
  8. Replies
    8
    Views
    450

    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 {
  9. Replies
    10
    Views
    1,078

    Write code that makes sense.

    Write code that makes sense.
  10. Replies
    8
    Views
    450

    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...
  11. Replies
    3
    Views
    366

    printf requires a format spec. Which did you use?...

    printf requires a format spec. Which did you use? The proper format for size_t is %zu. The proper one for ssize_t is %zd.
    When you assign -1 to an unsigned value it's interpreted as the maximum...
  12. Replies
    15
    Views
    890

    An addition to the 'if/else if' chain to handle...

    An addition to the 'if/else if' chain to handle another possible error:


    if (*utf8 < 0x80)
    else if (*utf8 < 0xC0)
    return false; // out-of-place continuation byte:...
  13. Replies
    15
    Views
    890

    Excellent! Apparently "" means the...

    Excellent! Apparently "" means the "user-preferred locale".
    You could try printing the return value of setlocale(LC_ALL, "") (as %s).
    If you're in Britain it's probably going to say en_GB.UTF-8...
  14. Replies
    15
    Views
    890

    Your conversion of UTF-8 to a unicode code point...

    Your conversion of UTF-8 to a unicode code point is wrong.
    For example, it converts ό (greek small letter omicron with oxia) to 0x12172769 instead of the correct 0x1F79.
    It should be something like...
  15. Don't recompile the C program for every...

    Don't recompile the C program for every invocation!
    Instead, pass the size as a command-line argument and dynamically allocate the memory.
    In the bash script, if you wanted a dimension of 100 you...
  16. Replies
    10
    Views
    1,078

    The code doesn't really make sense. What do you...

    The code doesn't really make sense.
    What do you want it to do?
  17. That's a definite match. And the thread is still...

    That's a definite match. And the thread is still active after more than five years! It looks to be hugely complicated and they haven't gotten to "row 160" yet. I wonder what sam444 is up to here.
  18. Replies
    16
    Views
    808

    What do you mean? snprintf() always returns the...

    What do you mean? snprintf() always returns the number of characters that were (or would be) written. Why wouldn't it?
  19. Replies
    4
    Views
    504

    You seem to be making a few incorrect...

    You seem to be making a few incorrect assumptions.
    0xff is not the same as "FF".
    "FF" are two 'F' character codes (70 or 0x46 in ascii or utf-8).
    Also, memcmp doesn't compare a single thing a...
  20. Thread: Composition

    by john.c
    Replies
    11
    Views
    1,095

    I feel like I've seen this somewhere else. If...

    I feel like I've seen this somewhere else. If you've posted on multiple websites you should mention that fact and give the links to your other posts so that people here don't waste their time...
  21. Replies
    7
    Views
    730

    You're not giving enough information to help you....

    You're not giving enough information to help you.
    Post a link to the problem.
  22. Since it's easy to change it to vector I'll...

    Since it's easy to change it to vector<char> I'll leave that to you.
  23. Replies
    7
    Views
    730

    Maybe something like this: { "cmd":...

    Maybe something like this:


    {
    "cmd": "/usr/bin/sh",
    "args": [
    "-c",
    "the command you want to run",
    ],
    "secret": "supersecretpassword"
  24. Replies
    7
    Views
    730

    You found this exact source code and an a.out...

    You found this exact source code and an a.out that you assume is the corresponding executable.
    You believe that you need to create a config.json file with the correct fields.
    So how are we supposed...
  25. Clearly I still have something to learn about...

    Clearly I still have something to learn about guruship. :)
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4