Xref: utzoo comp.unix.questions:13144 comp.unix.wizards:15829 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucdavis!uop!jeff From: jeff@uop.edu (Jeff Ferguson) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: system() --- the C function from hell? Keywords: system, unix, question, does anyone use this line? Message-ID: <1827@uop.edu> Date: 30 Apr 89 02:52:01 GMT Organization: University of the Pacific, Stockton, CA Lines: 42 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@uop.edu Computer Science Department | uop!jeff@ucdavis.edu University of the Pacific | cogent!uop!jeff@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".