Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Floating Error (http://www.go4expert.com/forums/floating-error-t6878/)

PumaMan 17Oct2007 11:43

Floating Error
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):


main(int argc, char *argv[])
  pid_t pid; int ret_value, T, sleeptime;
  T = atoi(argv[1]);
  pid = getpid();
  ret_value = (int) (pid %256); 
  sleeptime = rand()%T;

And the calling function:


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!

All times are GMT +5.5. The time now is 19:35.