Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Can't find, now, the actual reference on make...

    Can't find, now, the actual reference on make manual, but uninitialized variables aren't exported:

    # Makefile

    #X=1
    export X

    all:
    make -f Makefile.2
  2. Replies
    3
    Views
    310

    As always, john.c codes are flawless. But I would...

    As always, john.c codes are flawless. But I would insert two more checks on encrypt() - to see if both files are different and to see if the output file was opened. Consider the case where 'text.txt'...
  3. Notice that exec?() WILL return in case of error.

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

    As it should. Simple. Change the code.

    As it should.

    Simple. Change the code.
  5. Replies
    25
    Views
    1,654

    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,...
  6. Beej's Guide to Networking...

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

    0xc41598 = 12850584
  8. Replies
    5
    Views
    437

    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;
    }
    }
  9. Replies
    6
    Views
    698

    Did you tried?

    Did you tried?
  10. Replies
    11
    Views
    607

    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;
    }
  11. Replies
    11
    Views
    607

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

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

    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?
  13. Google (or Duckduck Go) is your friend: Completly...

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

    by flp1969
    Replies
    10
    Views
    756

    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".
  15. Thread: Word Counting

    by flp1969
    Replies
    10
    Views
    756

    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...
  16. 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(); }
  17. Replies
    9
    Views
    901

    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++ )
  18. Replies
    7
    Views
    521

    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...
  19. Replies
    7
    Views
    521

    Are you sure the equation is correct? 16382

    Are you sure the equation is correct?

    16382
  20. Replies
    20
    Views
    1,253

    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...
  21. Replies
    3
    Views
    410

    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
  22. 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;
  23. Replies
    37
    Views
    3,354

    Here's how: 16365

    Here's how:
    16365
  24. 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...
  25. 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...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4