Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Interesting. I didn't know this! I prefer to...

    Interesting. I didn't know this!
    I prefer to deal with multidimensional arrays as an argument through a single pointer:

    void f(int size, int *ptr)
    {
    int i, j, *p;
    for ( i = 0; i < size;...
  2. Replies
    23
    Views
    165

    @Structure, think of it in this way... ANY...

    @Structure, think of it in this way... ANY comparison will result in 0 or 1... And, in C, 0 means "false", everything else, "true". So:

    if ( ! ( size = file_get_size( &ret, path ) ) ) ...
    In this...
  3. Replies
    7
    Views
    90

    Do you want to know WHY 2147483619 was printed or...

    Do you want to know WHY 2147483619 was printed or the answer @Structure gave you is enough?
  4. RAW sockets on Level 2... Easy to do in Linux......

    RAW sockets on Level 2...
    Easy to do in Linux... hard to do in everything else...
  5. Replies
    6
    Views
    144

    Here's a small example using SDL2: // sdl.c...

    Here's a small example using SDL2:

    // sdl.c
    //
    // $ cc -O2 `pkg-config --cflags sdl2 SDL2_image` \
    // -o sdl sdl.c \
    // `pkg-config --libs sdl2 SDL2_image`
    //
    #include...
  6. Replies
    6
    Views
    144

    If you want the image to fill the entire window,...

    If you want the image to fill the entire window, you have some options: Get the maximized Window width and height and resize the image object accordingly... Notice if your image have a different...
  7. Replies
    6
    Views
    144

    Here: // test.c // Tested with: // // $ cc...

    Here:

    // test.c
    // Tested with:
    //
    // $ cc -O2 `pkg-config --cflags gtk+-3.0` \
    // -o test test.c \
    // `pkg-config --libs gtk+-3.0`
    // $ ./test pic.jpg
    //
  8. Replies
    6
    Views
    144

    Did you try to add a call to...

    Did you try to add a call to gtk_window_maximize() between lines 14 and 15 (or at line 21, before showing the window)?
  9. Replies
    9
    Views
    148

    /proc/[pid]/mem requires PTRACE permissions, as...

    /proc/[pid]/mem requires PTRACE permissions, as told in the manpage:



    /proc/[pid]/mem
    This file can be used to access the pages of a process's memory through
    ...
  10. Replies
    9
    Views
    148

    "pear shaped"? When creating directories, the...

    "pear shaped"?

    When creating directories, the 'x' permission have a different meaning than for files: They mean 'search', meaning if you don't set this permission, you'll not be able to 'search'...
  11. Replies
    30
    Views
    377

    There is no 'exename', but there is a 'comm': ...

    There is no 'exename', but there is a 'comm':

    15962

    Just the executable name...
  12. Replies
    30
    Views
    377

    Since you want to allocate the right amount of...

    Since you want to allocate the right amount of memory to read the "executable" name, you do know scanf() can allocate the buffer dynamically, don't ya?

    #include <stdio.h>
    #include <stdlib.h>...
  13. Replies
    30
    Views
    377

    I really didn't understand what you really want....

    I really didn't understand what you really want.
    Take a look at procfs manpage to see what /proc/[pid]/stat offer. Maybe you want something like /proc/[pid]/statm (notice the 'm' at the end).
    BTW:...
  14. Replies
    5
    Views
    167

    Network Time Protocol (NTP)

    Network Time Protocol (NTP)
  15. First: Read the INSTALL file... Check what...

    First: Read the INSTALL file...

    Check what header file declares the function in INCLUDE_DIR
    Check which library to use in LIB_DIR
  16. Replies
    8
    Views
    244

    Wow... I didn't notice the '0xAA' (between single...

    Wow... I didn't notice the '0xAA' (between single quotes)... :)
  17. Yep... I've heard about antique systems with 9...

    Yep... I've heard about antique systems with 9 bit bytes and 36 bits word size! (PDP-7?) :)
  18. Thank you! This is very useful! []s Fred

    Thank you! This is very useful!

    []s
    Fred
  19. You are right: __builtin_clzll() and it is not...

    You are right: __builtin_clzll() and it is not portable... and I forgot sizeof returns the number of bytes, so I need to multiply sizeof( size_t ) by 8 as well... :)

    There is a small confusion...
  20. A small correction on Post #5: ......

    A small correction on Post #5:


    ...
    new_capacity = 1ULL << ( 8 * sizeof ( size_t ) - __builtin_clz( needed ) - 1);
    ...
  21. An warning: Don't do this: nodes = realloc(...

    An warning: Don't do this:

    nodes = realloc( nodes, *capacity * sizeof( Node ) );
    reallod() can fail (returning NULL). In that case, you'll loose the address contained in nodes pointer and get a...
  22. Replies
    72
    Views
    855

    Why not keep this simple. You are not, obviously,...

    Why not keep this simple. You are not, obviously, interested in a cryptographically secure RNG, so LCG, Mersene Twister, Xorshift128 or any other PRNG is suitable. A thread safe LCG is easy enough to...
  23. Replies
    8
    Views
    244

    0xA0 isn't ASCII or a valid UTF-8 char. In...

    0xA0 isn't ASCII or a valid UTF-8 char. In ISO-8859-1 (Latin1) or WINDOWS-1252 is a "non breaking space"...
    The printed char depends on your encoding... Example... if you do:

    ...
  24. Replies
    72
    Views
    855

    What suprises me is that you are dealing with...

    What suprises me is that you are dealing with mathematical problems (floating point, random numbers), but refuse to learn the proper mathematics...
  25. Replies
    72
    Views
    855

    Good books about random number generators: Luc...

    Good books about random number generators:

    Luc Devroye - Non Uniform Random Variates

    and, of course, volume 2 of the art of computer programming by Donald E. Knuth

    Donald E. Knuth - The Art...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4