system() --- the C function from hell?
Jeff Ferguson
jeff at uop.edu
Sun Apr 30 12:52:01 AEST 1989
Hi kids,
The system() call seems to wreak havoc with integer variables.
I have the following code:
/****** Code *******/
int lowp, hip;
...
scanf("%d", &hip);
scanf("%d", &lowp);
sprintf(str, "/bin/mkdir directory");
system(str);
...
/**** End Of Code ****/
I printed the values of LOWP and HIP before the system() call, and
everthing was pee-chee (like the folder). I print them out after
the call and the values have been blown to high Heaven: before they
were both 3, while after system(str) they are in the tens of millions.
OK, people, for $200 and the chance at the Chevy Sprint Turbo --- my
question is this: what is happenning here an how can it be fixed? I
am stymied.
Although I probably don't sound like it, I would be grateful (but not
dead) for any advice, suggestions, or visions from God. Thanks, and
please drive safely.
------------------------------------------------------------------------------
Jeff Ferguson | jeff at uop.edu
Computer Science Department | uop!jeff at ucdavis.edu
University of the Pacific | cogent!uop!jeff at pacbell.com
Stockton, California, USA |
95211 /^^^\ | "Get me out of this cage!" -- Rael
(209) 944-7105 { o_o } | .--------------------------.
\ o / ----> ( "KJEF does it with class!" )
---------------------mm---mm-------'--------------------------'---------------
"I met Andy Warhol at a really shiek party."
"Blow it out your hair, too, 'cause you work at Hardee's".
More information about the Comp.unix.questions
mailing list