Results 1 to 3 of 3
I must create shell program in c.
Change dir and Cls command for cleare screen.
I dont need use existing commands, i need programming shell code.
Plese Help me. Sorry ...
- 02-04-2010 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 1
How change dir using c program !!!
I must create shell program in c.
Change dir and Cls command for cleare screen.
I dont need use existing commands, i need programming shell code.
Plese Help me. Sorry my eanglish is bad. Greets from Bosnia. MILICA
- 02-04-2010 #2
i hope this is not homework
read these man pagesCode:man system man chdir
- 02-05-2010 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
In a C program, the system("cd newdir") will not work since the system/shell command called is context-sensitive. IE, the directory set is only valid for that temporary shell used to execute the command. You need to use the chdir() system call, which will change the working directory for your application. That's what shells like bash et al use.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote