Search:

Type: Posts; User: frs

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    6,238

    How can I make a switch case with run-time...

    How can I make a switch case with run-time variables then?
  2. Replies
    4
    Views
    6,238

    switch case with variables

    Why the following code doesn't give errors when I try to compile with gcc, and....



    #include <stdio.h>
    int x = 2;
    const int y = 2;

    switch(x)
    {
  3. Replies
    8
    Views
    19,210

    Hmm, thank you once again.

    Hmm, thank you once again.
  4. Replies
    8
    Views
    19,210

    so 14UL is the same as (unsigned long)14?? I'm...

    so 14UL is the same as (unsigned long)14?? I'm talking about the syntax, 0UL, never seen a cast made that way.
  5. Replies
    8
    Views
    19,210

    Thank you. Where can I find information about...

    Thank you.
    Where can I find information about these conventions?
  6. Replies
    8
    Views
    19,210

    ((uint32_t)(~0UL)) ??

    Can anyone explain this definition?


    #include <stdint.h>
    #include <stdbool.h>

    #define NULL_BLOCK ((uint32_t)(~0UL))
  7. Replies
    21
    Views
    2,301

    Because the devices are treated much differently.

    Because the devices are treated much differently.
  8. Replies
    21
    Views
    2,301

    Yes yes. That's it. That is what I was going...

    Yes yes. That's it.

    That is what I was going to do, I never did compiler optimizations..
    Probably I won't see any difference, but anyway is unnecessary to evaluate the switch statement in every...
  9. Replies
    21
    Views
    2,301

    I'm making a program to read data from USB...

    I'm making a program to read data from USB Devices (gamepads and joysticks).


    while(!poll_interrupt)
    {
    switch(dev_type)
    {
    case 1:
    fetch data from dev1;
    break
  10. Replies
    21
    Views
    2,301

    The idea was to assign an input parameter to the...

    The idea was to assign an input parameter to the 'const char' , so it would have to be evaluated at least one time.
  11. Replies
    21
    Views
    2,301

    I'm not saying I believe, I'm asking. What...

    I'm not saying I believe, I'm asking.



    What this has to do with the case?
  12. Replies
    21
    Views
    2,301

    print "1\n" in an infinite loop..

    print "1\n" in an infinite loop..
  13. Replies
    21
    Views
    2,301

    Edit Again. Maybe I haven't expressed myself...

    Edit Again.

    Maybe I haven't expressed myself well.

    Since n is a const variable, the compiler replaces the 'while' content into printf("1\n") only?
  14. Replies
    21
    Views
    2,301

    Edit. Sorry my bad.

    Edit. Sorry my bad.
  15. Replies
    21
    Views
    2,301

    evaluation of const variables

    In this piece of code the switch statement is evaluated only one time or not?



    const int n=1;

    while(1)
    {
    switch( n )
    {
  16. Thread: static variables

    by frs
    Replies
    2
    Views
    1,127

    static variables

    I have this statement inside a function, that opens a XML file.


    static auto_ptr<Remote> remoteXML (Remote_("../config/remote_conf.xml"));

    The XML file is opened every-time I call the function...
  17. Replies
    2
    Views
    6,536

    redirecting stdout of child process

    I'm attempting to read the messages sent by the child by forking, exec, and redirecting stdout. But the read messages are only printed after the child has finished, why this happens? Has something to...
  18. Replies
    8
    Views
    3,511

    here's my effort. I've redirected stdout of the...

    here's my effort. I've redirected stdout of the child to a pipe. The resulting output is on below.I still have some problems..

    1- Can anyone explain why the parent process only reads from the...
  19. Thread: fflush() help

    by frs
    Replies
    1
    Views
    1,627

    fflush() help

    Can anyone explain the role of fflush in this code? The output is 0 .. 1 .. 2 til 9. When I remove the fflush, it prints 0 1 2 3 4 5 6 7 8 9 at once after 10 seconds. Why?


    #include <stdio.h>...
  20. Replies
    8
    Views
    3,511

    When I fork() , the stdout and stdin are shared...

    When I fork() , the stdout and stdin are shared by both parent and child?
  21. Replies
    8
    Views
    3,511

    Thank you for the answers. WNOHANG returns...

    Thank you for the answers. WNOHANG returns immediately if no child has exited, I don't want that. The idea is forking, suspend the parent and exec( a program I can't modify ).
    The exec program sends...
  22. Replies
    8
    Views
    3,511

    I've the following question. pid_t pid...

    I've the following question.



    pid_t pid = fork();

    if(pid == 0) /* child */
    {
    if(execl("/usr/bin/sixad","sixad","-s",NULL)==-1);
    {
  23. Replies
    8
    Views
    3,511

    if I use waitpid(), the calling process suspends...

    if I use waitpid(), the calling process suspends its course until the child has terminated, isn't that correct?
  24. Thread: manage processes

    by frs
    Replies
    1
    Views
    1,084

    manage processes

    (Using C on ubuntu)

    In my program I need to fork a process and execute a .bin in the child process. Then I want to create a pipe that "connects" the stdout of the child to the stdout of the...
  25. Replies
    8
    Views
    3,511

    create and listen to a process

    (Using C on ubuntu)

    In my program I need to fork a process and execute a .bin in the child process. Then I want to create a pipe that "connects" the stdout of the child to the stdout of the...
Results 1 to 25 of 30
Page 1 of 2 1 2