diff command?

  • Thread starter Lionel van den Berg
  • Start date
L

Lionel van den Berg

Hi all,

I'm wondering if there is a diff function like the unix command in C++?

In fact I would like to know if you can call the unix (I should say
*nix) command from within a c++ application?

Also I have a binary that has been compiled by a friend, is there a way
to call it from within a C++ application and pass it a parameter?

thanks,

Lionel.
 
V

Victor Bazarov

Lionel van den Berg said:
I'm wondering if there is a diff function like the unix command in C++?
No.

In fact I would like to know if you can call the unix (I should say *nix)
command from within a c++ application?

Use 'system' function. RTFM.
Also I have a binary that has been compiled by a friend, is there a way to
call it from within a C++ application and pass it a parameter?

Yes, use 'system' function. Also, search the newsgroup archives for the
keywords "system function C++". You will see more recommendations, I am
sure.

V
 
K

Karsten Baumgarten

Lionel said:
Hi all,

I'm wondering if there is a diff function like the unix command in C++?

In fact I would like to know if you can call the unix (I should say
*nix) command from within a c++ application?

Also I have a binary that has been compiled by a friend, is there a way
to call it from within a C++ application and pass it a parameter?

thanks,

Lionel.

#include <stdlib.h>

int main ()
{
int retval = system ("diff foo bar");
}
 
L

Lionel van den Berg

Victor said:
Use 'system' function. RTFM.




Yes, use 'system' function. Also, search the newsgroup archives for the
keywords "system function C++". You will see more recommendations, I am
sure.

Great, thanks to both excellent and incredibly prompt responses :).

Lionel.
 
V

Victor Bazarov

Thomas said:
[...]
'popen' might even better fit your needs...

'popen' is not a standard C or C++ function. When giving an off-topic
response it is customary to supply some kind of explanation. Thanks.
 
R

Ron House

Victor said:
Thomas said:
[...]
'popen' might even better fit your needs...


'popen' is not a standard C or C++ function. When giving an off-topic
response it is customary to supply some kind of explanation. Thanks.

It's a posix standard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,652
Latest member
Campbellamy

Latest Threads

Top