Floating Error

Discussion in 'C' started by PumaMan, Oct 17, 2007.

  1. PumaMan

    PumaMan New Member

    Joined:
    Oct 17, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I am new to C and so can not figure out the source of error I am getting. I have a program that calls a second program and passes an argument to it. When I try to assign the argument to a variable in the second program, I get a "Floating Error" error message. The program being called (named child, edited to remove peripheral stuff):

    Code:
    main(int argc, char *argv[])
    {
      pid_t pid; int ret_value, T, sleeptime;
      
       T = atoi(argv[1]);
       pid = getpid(); 
       ret_value = (int) (pid %256);  
       srand(pid);  
       sleeptime = rand()%T; 
       sleep(sleeptime);
    }
    
    And the calling function:

    Code:
    int main(int argc, char *argv[])
    {
       pid_t pid, w; int k, status, T, N; char value[2];
    
       
       // get command line arguments
     
       T = atoi(argv[1]);
       
      execl("child", "child", value, (char *) 0); 
     
    }
    
    Any help you can give me would be very appreciated...thanks!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice