Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!ritcv!cci632!ccicpg!miket From: miket@ccicpg.UUCP (Mike Tracy) Newsgroups: comp.lang.c Subject: Re: system Keywords: c program Message-ID: <9472@ccicpg.UUCP> Date: 19 Jan 88 23:45:31 GMT References: <127@dcrbg1.UUCP> Reply-To: miket@ccicpg.UUCP (Mike Tracy) Organization: CCI CPG, Irvine CA Lines: 22 In article <127@dcrbg1.UUCP> bcf2303@dcrbg1.UUCP (Wing Chow) writes: > >can someone give me an example of how to use 'system' in a c program? The best example I have is the mkdir command. Since a normal user can not create a directory. The mkdir (under Unix) is a SUID root program. That is, when the program is envoked its effective user id is that of the super user (stupid user :-)) root. To make a directory from you C program (unless your program is SUID root) you must use the system call (with the appropriate checks for success). system( "mkdir mydir" ); Michael D. Tracy Computer Consoles Incorporated (714)458-7282 9801 Muirlands Boulevard Irvine, CA 92718 {allegra!hplabs!felix,seismo!rlgvax}!ccicpg!miket