Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.17 seconds; generated 45 minute(s) ago.

  1. Yeah, waitpid() isn't going to work. Unless...

    Yeah, waitpid() isn't going to work.

    Unless the pid is a genuine child process, then the error return is always "No child processes" regardless of whether the process exists or not.

    Plan B -...
  2. > this is a good way the problem is what are the...

    > this is a good way the problem is what are the advantages and disadvantages ?
    In the 4 minutes it took you to reply, did you write and test the code to use waitpid?

    How much more/less code did...
  3. Here's one perhaps. waitpid(2): wait for process...

    Here's one perhaps.
    waitpid(2): wait for process to change state - Linux man page

    There's another, but I'm keeping an air of mystery for a while.
    To see if you can find it (or someone else...
  4. Replies
    28
    Views
    457

    > # elif ('\0'|(1

    > # elif ('\0'|(1 << (CHAR_BIT-1))) < 0

    The whole thing is just going to get promoted all the way up some large type.
  5. Replies
    3
    Views
    246

    It's impossible to verify your formulas based on...

    It's impossible to verify your formulas based on your fuzzy pictures taken from your phone.


    First off, remove useless fluff


    baz.cpp: In function ‘int main()’:
    baz.cpp:16:10: warning:...
  6. Replies
    9
    Views
    260

    You have a lot of direct and indirect recursion...

    You have a lot of direct and indirect recursion of task_switcher().

    Multiple global variables called 'lock', 'count' and 'str' doesn't help with readability.

    Here's my take on your two tasks.
    ...
  7. Replies
    5
    Views
    146

    You seem to have forgotten most of what you...

    You seem to have forgotten most of what you learnt.
    Error: assignment of i_value in read-only object

    Study post #21 in detail.
  8. Replies
    4
    Views
    119

    Your program was screwed from the moment it did...

    Your program was screwed from the moment it did
    strcat(strA,strB);

    There's no point trying to rationalise any right/wrong/weird behaviour beyond that point.
    The code is broken and needs to be...
  9. Replies
    5
    Views
    146

    You're ignoring things. $ gcc -g -Wall foo.c...

    You're ignoring things.


    $ gcc -g -Wall foo.c
    foo.c: In function ‘add_end’:
    foo.c:43:5: warning: ‘return’ with no value, in function returning non-void
    return;
    ^
    foo.c: In function...
  10. > while( iter < maxIter or ea > es ) Perhaps...

    > while( iter < maxIter or ea > es )
    Perhaps you wanted 'and' rather than 'or'

    Remember that 'and(&&)' and 'or(||)' are short-circuit evaluated.
    If the left of || is true, the right isn't even...
  11. Replies
    4
    Views
    119

    > char strA[] = "OPC"; This tells the...

    > char strA[] = "OPC";
    This tells the compiler to count the characters between the "" and make an array of that size.
    So what you really have is strA[4] in this case.

    > char strB[20] =...
  12. Replies
    9
    Views
    260

    Is data_print really an ISR capable of only...

    Is data_print really an ISR capable of only printing one character at a time to some external device?
  13. Replies
    9
    Views
    260

    Well no, you can't assign the contents of what a...

    Well no, you can't assign the contents of what a pointer points to to an array.

    That's why we have functions like strcpy.

    You should find a way of solving your question without so many messy...
  14. Replies
    5
    Views
    323

    > Does anyone know the calculation to do that? ...

    > Does anyone know the calculation to do that?
    Pencil, paper - and a bit of geometry.

    > I can calculate how to center a window on the desktop screen.
    Try doing the same, but introduce a left=0...
  15. Replies
    4
    Views
    164

    > float red2 = image[i][j + 1].rgbtRed; All...

    > float red2 = image[i][j + 1].rgbtRed;
    All these +1 and +2 are going to overflow your array bounds at the limits of your loops.



    float red = 0;
    float green = 0;
    float blue = 0;
    for ( int x...
  16. Replies
    2
    Views
    287

    Scroll down to the "Show threads from the..."...

    Scroll down to the "Show threads from the..." drop-down box.
  17. Replies
    13
    Views
    332

    > return (*(int *)ap > *(int *)bp) - ( *(int *)ap...

    > return (*(int *)ap > *(int *)bp) - ( *(int *)ap < *(int *)bp );
    Unnecessarily terse, and contains a bug.
    Try again.
  18. Replies
    13
    Views
    332

    > printf("%d", list[j]); Move it into the i...

    > printf("%d", list[j]);
    Move it into the i loop, and print subscript i instead.

    Also, you don't need an array of temp, just one.
  19. Replies
    13
    Views
    332

    You're not swapping anything at line 17. Swaps...

    You're not swapping anything at line 17.

    Swaps typically take 3 lines of code.
  20. Replies
    3
    Views
    161

    Have you tried pressing 9 and then enter?

    Have you tried pressing 9 and then enter?
  21. Replies
    6
    Views
    381

    So instead of learning how to solve a problem,...

    So instead of learning how to solve a problem, the OP has learnt that eventually, some schmuck will do their work for them.
  22. Replies
    12
    Views
    368

    > width = bmih.biWidth; if (width%4 != 0) width...

    > width = bmih.biWidth; if (width%4 != 0) width += (4-width%4);
    This is wrong.

    If you have a width of 9 pixels, and 3 bytes per pixel, you have 27 bytes of pixel data per row.

    It is the...
  23. Replies
    3
    Views
    209

    > In order to run this program, the following is...

    > In order to run this program, the following is done
    > ./justify <quote
    TBH, I would add a second option to justify, namely to open the file supplied as a command line argument.

    As in...
  24. Thread: Prime Factor

    by Salem
    Replies
    3
    Views
    148

    Cross-posted here -> Prime Factor - C And C++ |...

    Cross-posted here -> Prime Factor - C And C++ | Dream.In.Code
  25. Replies
    6
    Views
    381

    You start by breaking the problem down into...

    You start by breaking the problem down into simpler problems.

    Like for example, by trying to draw a cross and then an empty diamond


    ....0.....
    ....0.....
    ....0.....
    ....0.....
    000000000.
Results 1 to 25 of 499
Page 1 of 20 1 2 3 4