Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Calling Unix commands in C?
Name: too Date: August 23, 2002 at 07:15:02 Pacific
Comment:
Hellow, How to exploit basic Unix (linux) commands such as "rm","cd","ls","grep" in C programming? Firstly, I tried bash script but it is not convenient to concern with real number computing. Are there a set of functions in C compiler that behave like "rm","ls","grep"? Where I could get more information?
Name: ravi Date: August 23, 2002 at 08:11:38 Pacific
Reply:
I guess i wont be able to hundred% of u r problem but try this(since i am not sure whether paramaters are accepted by the system function) /*Use analog brackets */ #include"iostream.h" #include"stdio.h"/*optional*/ #include"stdlib.h" void main() { system("ls"); system("cd .."); system("mkdir hello"); system("rmdir hello")
} if this gives an error report me back
0
Response Number 2
Name: too Date: August 23, 2002 at 09:07:31 Pacific
Reply:
Thank you, Your answer is very helpful. By adding ; to the last statement, the code is workable.But no "iostream.h" available for both Unix and Linux.
0
Response Number 3
Name: Sajid Mohammed Date: August 23, 2002 at 13:02:59 Pacific
Reply:
Hi, What do you mean by iostream.h not available. It is a C++ library and if you use C++ language then you should include that file Sajid Mohammmed sajleo@yahoo.com
0
Response Number 4
Name: Ravi Date: August 23, 2002 at 23:17:44 Pacific
Reply:
My friend iostream doesn.t work because u have installed only the C compiler but not the c++(GCC,C++)compiler .... To be 100 % sure try working with Classes and objects .Sajid is absolutely right. iF while compiling the code if u get an error(remember to write the syntxs properly)then u r using a C COMPILER and not C Also try to ind out if there is any file named gcc , c++ in /root , /usr/*(reffers to all dir's especially /bin and /sbib) , /bin ,/sbin,/usr/* etc .....
0
Response Number 5
Name: Ravi Date: August 23, 2002 at 23:39:03 Pacific
Summary: HOW CAN I RUN UNIX COMMANDS in VB6? i have started TELNET using APPACTIVATE and Shell function how can i login into the telnet using vb6 ? call me on Puneet 9821308954 email me puneetpalbedi@gmail.com...
Summary: You wont find Unix command in DOS because Unix is one operating system and DOS is another, each where their own different way of doing things. Also bear in mind, there is NO DOS in Windows XP. What ...
Summary: I'm not sure I remember from my C++ days (which are quickly coming back to haunt me since my operating systems class is all C...), but do you need to escape the slash? c:\\mydir This question is asked...