Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds; generated 53 minute(s) ago.

  1. Notice that exec?() WILL return in case of error.

    Notice that exec?() WILL return in case of error.
  2. Replies
    25
    Views
    1,149

    As it should. Simple. Change the code.

    As it should.

    Simple. Change the code.
  3. Replies
    25
    Views
    1,149

    Why "reverse" the buffer if you can fill it...

    Why "reverse" the buffer if you can fill it backwards?


    #include <stdio.h>

    static int digits10( unsigned int n )
    {
    static const unsigned int vals[] =
    { 10U, 100U, 1000U, 10000U,...
  4. Beej's Guide to Networking...

    Beej's Guide to Networking
  5. 0xc41598 = 12850584

    0xc41598 = 12850584
  6. Replies
    5
    Views
    295

    static void arrayShiftLeft( int *arr, size_t...

    static void arrayShiftLeft( int *arr, size_t nelems )
    {
    if ( nelems )
    {
    int tmp = *arr;
    memmove( arr, arr+1, (nelems - 1)*sizeof *arr );
    arr[nelems - 1] = tmp;
    }
    }
  7. Replies
    6
    Views
    567

    Did you tried?

    Did you tried?
  8. Replies
    11
    Views
    444

    And... also, you can use "perror()" to show you...

    And... also, you can use "perror()" to show you the error:


    f = fopen( "c:/file.txt", "w" );
    if ( f == NULL )
    {
    perror( "fopen" );
    return 1;
    }
  9. Replies
    11
    Views
    444

    Ahhh... even on Windows you can use '/', instead...

    Ahhh... even on Windows you can use '/', instead of '\\', in C, as in "c:/file.txt".
  10. Replies
    11
    Views
    444

    Do you have permission to create a file in the...

    Do you have permission to create a file in the root directory of drive C:? Open a prompt and try:

    c:\> echo "hello" > file.txt

    Are you using MSYS? Cygwin?
  11. Google (or Duckduck Go) is your friend: Completly...

    Google (or Duckduck Go) is your friend: Completly fair scheduler
  12. Thread: Word Counting

    by flp1969
    Replies
    10
    Views
    647

    Yep... just to demonstrate the point: "The word...

    Yep... just to demonstrate the point: "The word 'word' is the word.", if not properly dealt with, will give one word of each "The", "the", "'word'", "word" and "word." and "is".
  13. Thread: Word Counting

    by flp1969
    Replies
    10
    Views
    647

    What is a 'word' in this context? Take your text,...

    What is a 'word' in this context? Take your text, above, as an example: punctuation will be considered as part of the 'word' or your files are only lists of words?

    A better approach would be to...
  14. An interesting bug on CLANG (at least in version 11)

    #include <stdio.h>

    static void (*ptr)(void) = NULL;

    void f(void) { puts( "hello" ); }

    void g(void) { ptr = f; }

    int main( void ) { ptr(); }
  15. Replies
    9
    Views
    717

    An interesting bug on GCC 9 and above

    #include <stdio.h>

    int main ( void )
    {
    unsigned int a;
    unsigned int b;
    unsigned int c;

    c = 0;
    for ( a = 0; a < 10; a++ )
  16. Replies
    7
    Views
    391

    And... let's say the first equation is correct......

    And... let's say the first equation is correct... So, you want to calculate a FUNCTION, isn't it? Why not to code a function f()?


    double f(double t)
    {
    return...
  17. Replies
    7
    Views
    391

    Are you sure the equation is correct? 16382

    Are you sure the equation is correct?

    16382
  18. Replies
    20
    Views
    949

    Tip, works with GCC, CLANG and Intel C++ Compiler...

    Tip, works with GCC, CLANG and Intel C++ Compiler (but I'm not sure of __attribute__ syntax there... probably __declspec):



    void cleanup_str( char **p ) { free( *p ); }
    ...
    /* Some function...
  19. Replies
    3
    Views
    328

    Read the code again... the result of memcmp is...

    Read the code again... the result of memcmp is being asserted, not if sizeof(data_in)==0
  20. The compiler must know about the identifiers it...

    The compiler must know about the identifiers it is using... So, you can do:

    // file1.c
    int x = 10;

    // main.c

    // The compiler must know that 'x' exists elsewhere!
    extern int x;
  21. Replies
    37
    Views
    2,651

    Here's how: 16365

    Here's how:
    16365
  22. Ahhhh... of course: 16363 I just don't know if...

    Ahhhh... of course:
    16363
    I just don't know if double precision is sufficient to hold factorials of "big" numbers (like INT_MAX-2).

    Testing here: 171 will cause overflow! 1755! overflows for...
  23. You do notice that your function is not well...

    You do notice that your function is not well behaved for some values of x, don't you?
    16361
    And it's worse: The denominator isn't continuous for a lot of values (if considering x integer, it is...
  24. Replies
    11
    Views
    950

    rand() is a pseudo random number generator. It...

    rand() is a pseudo random number generator. It isn't really random, just appears to be. It depends on the initial value seeded to the algorithm. If this value is 12, rand() will always give you the...
  25. If the code is too complex for you to fix for...

    If the code is too complex for you to fix for Windows (I don't do Windows in 14 years), then forget it... The explanation in post #9 should be sufficient.

    And, yet... you forget, in both codes, to...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4