Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    99

    Yep.. use open() to get a file desciptor and... ...

    Yep.. use open() to get a file desciptor and...



    ... there is a special syscall to deal with devices: ioctl(), to send "commands" to control the device. Those commands are device dependent...
  2. Replies
    7
    Views
    167

    Problematic: #ifndef SIZE_END_BIT ...

    Problematic:



    #ifndef SIZE_END_BIT

    #define SIZE_END_BIT ~(SIZE_MAX>>1)

    #endif
  3. void dosomething( int *p ) { *p = 1; } void...

    void dosomething( int *p )
    { *p = 1; }

    void print( int *p )
    { printf( "%d\n", *p ); }

    int main ( void )
    {
    int x;
  4. Replies
    5
    Views
    319

    Ask yourself: "What is the origin for a 'child'...

    Ask yourself: "What is the origin for a 'child' window?" Is it the "desktop" or its parent window? And what if you have multiple monitors?
  5. Replies
    20
    Views
    375

    Even more: The pre-processor "code" below will...

    Even more: The pre-processor "code" below will always result in CHAR_BIT == 8:


    #ifndef CHAR_BIT
    #if ~0 << 8
    #define CHAR_BIT 8
    #elif ~0 << 7
    #define CHAR_BIT 7
    #elif ~0 << 6
    #define...
  6. Replies
    12
    Views
    365

    BMP file format - Wikipedia...

    BMP file format - Wikipedia
  7. Replies
    1
    Views
    112

    Google or DuckduckGo are your friends. Use...

    Google or DuckduckGo are your friends. Use them...

    ODBC from C Tutorial Part 1
  8. Replies
    13
    Views
    328

    You are aware that any recursive routine can be...

    You are aware that any recursive routine can be made without recursion, right?

    Here's a quicksort without recursion (using an allocated stack):

    #include <stdio.h>
    #include <stdlib.h>
    ...
  9. Replies
    13
    Views
    328

    Do you mind to clarify?

    Do you mind to clarify?
  10. Replies
    13
    Views
    328

    A more "generic" approach: #include ...

    A more "generic" approach:

    #include <stdlib.h>

    // Comparison funcions named after type and identifier.
    #define QSORT_CMP_FN_ASC(T,FN) FN ## _ ## T ## _A
    #define QSORT_CMP_FN_DESC(T,FN) FN ##...
  11. Replies
    13
    Views
    328

    #define INTARRAY_ELEMENTS(a) \ (sizeof a /...

    #define INTARRAY_ELEMENTS(a) \
    (sizeof a / sizeof a[0])

    static int cmp( const void *ap, const void *bp )
    { return (*(int *)ap > *(int *)bp) - ( *(int *)ap < *(int *)bp ); }

    ...
    int...
  12. Replies
    2
    Views
    180

    This is a null expression. The use of (void)...

    This is a null expression. The use of (void) there is an attempt to avoid a compiler warning... Not really necessary (because the expression is null, but valid).
  13. Replies
    3
    Views
    205

    No problems here: $ cc -g -o test test.c $...

    No problems here:

    $ cc -g -o test test.c
    $ echo 'test' > input
    $ gdb test
    Reading symbols from test...done.
    (gdb) r < input
    Starting program ./test < input
    test
    [Inferior 1 (process 8995)...
  14. This is WRONG: int index; while ( ( index...

    This is WRONG:


    int index;

    while ( ( index = strstr( str1, str2 ) ) != NULL ) ...
  15. You could keep 'sum' as integer (with more...

    You could keep 'sum' as integer (with more precision then individual values) and just convert to 'long double' (which have the same precision, in bits, as 'long long') when you calculate the mean:
    ...
  16. Thread: Run a program

    by flp1969
    Replies
    3
    Views
    278

    Hehehe... ;)

    Hehehe... ;)
  17. Replies
    12
    Views
    389

    I really don't get it... Do you realize that a...

    I really don't get it... Do you realize that a "byte" is 8 bits, so, by definition "binary data", don't ya?
  18. Yep, I notice... Since did a good try I thought...

    Yep, I notice... Since did a good try I thought it wasn't that harmul to show a different approach...
  19. Odd numbers between 20 and 100 are between 21...

    Odd numbers between 20 and 100 are between 21 (not 19) and 99:


    #include <stdio.h>

    int main( void )
    {
    int n = 21; // first odd value between 20 and 100.
    int sum = 0;
  20. I strongly recommend that you don't use floating...

    I strongly recommend that you don't use floating point types with currency calculations.

    Because of the nature of floating point implementation, most values aren't exact and due to rounding, some...
  21. As said here before, floating point values are...

    As said here before, floating point values are (often) approximations. Furthermore, they are binary representations of rational values (ℚ domain), not real values (ℝ domain). A decimal value,...
  22. Replies
    1
    Views
    244

    gSOAP (https://www.genivia.com/dev.html)

    gSOAP
  23. Replies
    4
    Views
    308

    Aren't you forgetting about multibyte charsets?

    Aren't you forgetting about multibyte charsets?
  24. int count_digits( char *s ) { int counter =...

    int count_digits( char *s )
    {
    int counter = 0;

    for (; *s; s++ )
    if ( isdigit( *s ) )
    counter++;

    return counter;
    }
  25. Replies
    4
    Views
    412

    From the wiki article: "All of the integer...

    From the wiki article:

    "All of the integer values are stored in little-endian format (i.e. least-significant byte first)."
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4