By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

diff command?

P: n/a
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.
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Lionel van den Berg wrote:
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");
}
--
Regards,

Karsten
Jul 23 '05 #2

P: n/a
"Lionel van den Berg" <ch***********@hotmail.com> wrote...
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
Jul 23 '05 #3

P: n/a
Victor Bazarov wrote:
"Lionel van den Berg" <ch***********@hotmail.com> wrote...
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.


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

Lionel.
Jul 23 '05 #4

P: n/a
Lionel van den Berg wrote:
Victor Bazarov wrote:
"Lionel van den Berg" <ch***********@hotmail.com> wrote...
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.

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

Lionel.


'popen' might even better fit your needs...

Tom
Jul 23 '05 #5

P: n/a
Thomas Maier-Komor wrote:
[...]
'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.
Jul 23 '05 #6

P: n/a
Victor Bazarov wrote:
Thomas Maier-Komor wrote:
[...]
'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.

--
Ron House ho***@usq.edu.au
http://www.sci.usq.edu.au/staff/house
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.