Search:

Type: Posts; User: qwertylurker

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    3
    Views
    1,060

    Check the value of temp just before calling...

    Check the value of temp just before calling kill(). According to man 2 kill, kill() kills multiple processes if the pid supplied is not positive.
  2. Replies
    7
    Views
    5,375

    message needs to be a char array, right?

    message needs to be a char array, right?
  3. Replies
    19
    Views
    11,180

    Hi. You can use a static local variable to...

    Hi.

    You can use a static local variable to keep track of number of invocations and print the appropriate string. Static variables retain their value across function calls.




    int...
  4. Replies
    1
    Views
    963

    When you type a command in the terminal and hit...

    When you type a command in the terminal and hit enter, the shell searches for an executable of that name in certain directories like /usr/bin, /sbin, /usr/local/bin etc. The list of these directories...
  5. Replies
    3
    Views
    3,062

    null pointer dereference

    I was looking at the container_of macro, and this piece of code confuses me a bit:


    const typeof( ((type *)0)->member ) *__mptr = (ptr);

    Why is it legal to cast 0 (null pointer?) into some...
  6. You declared get_cmd as a function that is...

    You declared get_cmd as a function that is supposed to return integer

    int get_cmd() /*Return type is int*/
    {
    ....
    ....
    return(array); /*array is not an int*/
    }

    But then you...
  7. Hi nyekknyakk.:) The compiler errors/warnings are...

    Hi nyekknyakk.:) The compiler errors/warnings are usually helpful in finding the source of bugs.

    In your program, these lines strike to me as problematic:

    int cmd_str[20];
    It seems you have...
  8. Replies
    5
    Views
    1,171

    It doesn't work because the logic is flawed. Try...

    It doesn't work because the logic is flawed. Try working out the result in your mind when both nValue and nAdd are 1. The result should be 0b10 (decimal 2), but your code produces just 0b1 (decimal...
  9. Replies
    9
    Views
    5,893

    Why does the client need to access private data?...

    Why does the client need to access private data? You might get ideas for better class interface if you post your code here. If there's a very good reason to let the user of the class access private...
  10. And I wanted to see the most bits set in a...

    And I wanted to see the most bits set in a multiple of 15, as well. Just curious.
    4294967295 (ULONG_MAX) is divisible by 15. :)
  11. Unless I'm making some mistake reading the code,...

    Unless I'm making some mistake reading the code, control will enter this loop if n has 4 bits set or more than 25 bits set. If this is correct, what is the significance of 4 and 25 here? Why do you...
  12. Replies
    3
    Views
    1,015

    The first CVector here is the return type of the...

    The first CVector here is the return type of the function; almost all functions have a return type - a function might return int, or float or something else. This one returns an object of type...
  13. Replies
    1
    Views
    807

    Like this: cout

    Like this:


    cout<<array[4][0];
  14. Replies
    7
    Views
    9,410

    You could store the hex digits in a char array...

    You could store the hex digits in a char array (or better, a linked list) and print out the array in reverse order near the end of the program.
  15. Replies
    12
    Views
    1,549

    Put a getchar() after every scanf and one at the...

    Put a getchar() after every scanf and one at the end, before return.
    SourceForge.net: Leaves data in input buffer - cpwiki
  16. Replies
    2
    Views
    923

    "0" is a C-style string, not a char. Use single...

    "0" is a C-style string, not a char. Use single quotes for char - '0'.
  17. Keep dividing the number by 10 until you get...

    Keep dividing the number by 10 until you get something <= 99999.
  18. Replies
    3
    Views
    4,020

    Use a larger data type to join the two bytes ...

    Use a larger data type to join the two bytes



    unsigned char a=4;
    unsigned char b=5;
    unsigned short int c=0;
    c=a<<8;
    c+=b;
    printf("\nRPM=%d", c); //Prints 1029
  19. Replies
    4
    Views
    1,681

    It's because XOR of equal numbers is 0.

    It's because XOR of equal numbers is 0.
  20. Thread: Struct

    by qwertylurker
    Replies
    43
    Views
    4,229

    Typedefs save us some typing (I guess this makes...

    Typedefs save us some typing (I guess this makes the latter approach 'better') and are commonly used in projects involving structs.
  21. Replies
    6
    Views
    1,020

    A class with 2D bool arrays to represent the...

    A class with 2D bool arrays to represent the areas perhaps. I would initialize all elements (seats) of the arrays to 0 and set them to 1 one-by-one as the seats are reserved to indicate they've been...
  22. Replies
    10
    Views
    2,353

    In that case you need to read about C-style...

    In that case you need to read about C-style strings bit more to realize that each character of the string can be accessed using an index, as in strng[3] or strng[4] etc.
  23. Replies
    13
    Views
    12,325

    int main() { char c; c = getchar(); if...

    int main()
    {
    char c;
    c = getchar();
    if (c>65&&c<90)
    {
    c = c +32;
    printf("%c",c);
    }
    else
  24. Replies
    3
    Views
    1,303

    All modern Operating Systems should have a rename...

    All modern Operating Systems should have a rename program; you can call it using system().


    system("rename foo foo2");
  25. Replies
    3
    Views
    5,384

    Its an HTTP 302...

    Its an HTTP 302 response redirecting http://google.co.uk/ to http://www.google.co.uk/. libcURL can be set to follow HTTP redirects to the page you actually want.
Results 1 to 25 of 28
Page 1 of 2 1 2