|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
UNIX command line calls
I have a question on calling a UNIX command from a C++ program. Suppose I want to use the command
" finger >temp.txt " from a UNIX command line. How would I do this from a C++ program? I believe its system but I am not sure about the syntax. Can anybody help me out??? Thanks alot |
|
#2
|
||||
|
||||
|
system("finger > temp.txt");
Woo hoo, I believe that's my 1000th post here ![]() |
|
#3
|
|||
|
|||
|
Thats what I thought it was but when I tried my code on gcc compilier i get the following errors:
test.cpp: In function `int main(...)': test.cpp:4: implicit declaration of function `int system(...)' My code is this #include<iostream> void main() { system("finger > temp.txt"); } |
|
#4
|
||||
|
||||
|
Add this line near the #include <iostream>
Code:
#include <cstdlib> |
|
#5
|
|||
|
|||
|
AHHHHhh...so simple...thanks!!!!!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > UNIX command line calls |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|