Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi,im new to programmingin C in ubuntu and wanted to ask if we can execute ubuntu commands (such as 'ls','cd' etc) from our C program.if so,how?i dont get how to link our program with the OS's commands.please help.thanku

You have to use "C" system calls. The system() function can be used, but if you need to return the output of the command called from the "C" program, you must use the fork() call.Check out these links for examples:
http://www.cs.appstate.edu/~jtw/cs3...
http://www.tek-tips.com/viewthread....
http://www.computing.net/answers/so...

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |