Search:

Type: Posts; User: zyxwvuts

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    922

    If so, it's negligible. I'd suggest making the...

    If so, it's negligible. I'd suggest making the decision based on your style preferences. Two things worth noting about these snippets:

    * The cast may be omitted, as void *s may be converted to...
  2. I don't care for mahe's intentions, or Salem's...

    I don't care for mahe's intentions, or Salem's assumptions about them, as I post to talk about interesting things like programming. :-p

    What I have found is that the call to socket fails whenever...
  3. Please experiment with libpcap and socket, and...

    Please experiment with libpcap and socket, and find out for yourselves where the described security feature is implemented. It is more helpful than making hasty judgements about mahe's character.
  4. It's system dependent and it doesn't really have...

    It's system dependent and it doesn't really have anything to do with C. On Linux, I have personally taken the following approach.


    #include <stdio.h>
    #include <stdlib.h>
    #include <arpa/inet.h>...
  5. Thread: insertstr

    by zyxwvuts
    Replies
    30
    Views
    2,674

    It is not unsafe for the caller to know what...

    It is not unsafe for the caller to know what they're giving a function, it is simply unappealing to the lowest common denominator.

    #include <stdlib.h>

    char *insertstr(char *s, int split, const...
  6. Consider reading about the getc and fgets...

    Consider reading about the getc and fgets functions in <stdio.h>.
  7. Thread: insertstr

    by zyxwvuts
    Replies
    30
    Views
    2,674

    Hmm ... #include #include...

    Hmm ...


    #include <stdio.h>
    #include <string.h>

    char *insert(char *to, const char *s, int split, const char *in)
    {
    sprintf(to, "%.*s%s%s", split, s, in, s + split);
    return to;
  8. Replies
    7
    Views
    1,031

    Considering the exercise, this course seems like...

    Considering the exercise, this course seems like a rather lousy way to learn programming with C.
  9. A different approach: * Allocate storage for two...

    A different approach:
    * Allocate storage for two arrays. One, an array of char (char[]), the other, an array of pointer to char (char *[]).
    * Copy the whole (line?) into the first array.
    *...
  10. Replies
    23
    Views
    3,723

    So long as you are consistent when you write your...

    So long as you are consistent when you write your source code (by using either int32 or int32_t, but not both), the type name you use doesn't really matter. (There may, however, be portability issues...
  11. Replies
    23
    Views
    3,723

    char, float, and double are standard types. bool...

    char, float, and double are standard types. bool is provided by <stdbool.h> (a typedef for _Bool), and int32_t is provided by <stdint.h> if the C implementation happens to define a signed 32-bit...
  12. Replies
    8
    Views
    1,805

    The value that is stored in spoj1min is modified...

    The value that is stored in spoj1min is modified during each iteration, so the third line of your code snippet is equivalent to "spoj1min = spoj1min * 2", rather than the desired "spoj1min = spoj1min...
  13. Replies
    3
    Views
    1,237

    The way the function is currently defined, it...

    The way the function is currently defined, it will delete each element in the list that is equal to 'number' (and also, not the first element of the list.) But the name seems to imply that it will...
  14. It can help to break procedures into multiple...

    It can help to break procedures into multiple simpler ones. Consider the following break-down.

    * Translate upper-case to lower-case characters in a string.
    * Remove characters, in a string, that...
  15. Replies
    5
    Views
    1,601

    You're welcome. :-)

    You're welcome. :-)
  16. Replies
    5
    Views
    1,601

    There are a few ways to go about it, probably the...

    There are a few ways to go about it, probably the simplest is to write to a file from your program, and read from the file with gnome-terminal. The first thing to do is figure out how to run a...
  17. Replies
    5
    Views
    912

    I think it would be cleaner if you rewrote it so...

    I think it would be cleaner if you rewrote it so it depends less on preprocessor magic. That function definition probably doesn't need to be inside of a header, kernel_image_* probably doesn't need...
  18. Replies
    9
    Views
    1,393

    The type of 0xff would actually be int...

    The type of 0xff would actually be int.
  19. Replies
    10
    Views
    10,016

    The point I was trying to convey is that C will...

    The point I was trying to convey is that C will interpret the integer constant (not the representation) 0xffffffff as having the value that is commonly written as 4294967295. (See 6.4.4.1p4.)
  20. Replies
    10
    Views
    10,016

    To be clear, 0xffffffff is not -1, it is...

    To be clear, 0xffffffff is not -1, it is 4294967295. This value may or may not be representable by an int or an unsigned int (see 5.2.4.2.1p1). When the value cannot be represented by an int,...
  21. Replies
    6
    Views
    995

    How about: "if (Number < array[INDEX]) (do...

    How about: "if (Number < array[INDEX]) (do something)" ? The thing about arrays is you can reference elements in constant time. Maybe spend some more time reading about arrays in C.
  22. Hmm, this problem stumbled me too, but then I put...

    Hmm, this problem stumbled me too, but then I put spaces between each number, like: "1 2 3 4"

    Then I alternated each space with a pipe, so I'd get something like: "1 2 3|4", "1 2|3 4", "1 2|3|4",...
  23. 1. isn't part of the standard C...

    1. <conio.h> isn't part of the standard C library. Its inclusion may introduce undefined behaviour.

    2. main is defined with the type void(). This may have undefined behaviour on certain C...
  24. Replies
    8
    Views
    4,360

    Assuming that you're referring to exercises 1-13...

    Assuming that you're referring to exercises 1-13 and 1-14, you should note that the vertical histogram is presented only for those who want an extra challenge (with the 'standard' being the...
  25. Read the program's input from a FIFO and write to...

    Read the program's input from a FIFO and write to that FIFO from another terminal.

    In one terminal,

    mkfifo outgoing
    cat outgoing | nc node service

    Then in another terminal,
Results 1 to 25 of 46
Page 1 of 2 1 2