Connecting Tech Pros Worldwide Forums | Help | Site Map

diff command?

Lionel van den Berg
Guest
 
Posts: n/a
#1: Jul 23 '05
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.

Karsten Baumgarten
Guest
 
Posts: n/a
#2: Jul 23 '05

re: diff command?


Lionel van den Berg wrote:[color=blue]
> 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.[/color]

#include <stdlib.h>

int main ()
{
int retval = system ("diff foo bar");
}
--
Regards,

Karsten
Victor Bazarov
Guest
 
Posts: n/a
#3: Jul 23 '05

re: diff command?


"Lionel van den Berg" <charrliebrown@hotmail.com> wrote...[color=blue]
> I'm wondering if there is a diff function like the unix command in C++?[/color]

No.
[color=blue]
> In fact I would like to know if you can call the unix (I should say *nix)
> command from within a c++ application?[/color]

Use 'system' function. RTFM.
[color=blue]
> 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?[/color]

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

V


Lionel van den Berg
Guest
 
Posts: n/a
#4: Jul 23 '05

re: diff command?


Victor Bazarov wrote:[color=blue]
> "Lionel van den Berg" <charrliebrown@hotmail.com> wrote...
>[color=green]
>>I'm wondering if there is a diff function like the unix command in C++?[/color]
>
>
> No.
>
>[color=green]
>>In fact I would like to know if you can call the unix (I should say *nix)
>>command from within a c++ application?[/color]
>
>
> Use 'system' function. RTFM.
>
>[color=green]
>>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?[/color]
>
>
> Yes, use 'system' function. Also, search the newsgroup archives for the
> keywords "system function C++". You will see more recommendations, I am
> sure.[/color]

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

Lionel.
Thomas Maier-Komor
Guest
 
Posts: n/a
#5: Jul 23 '05

re: diff command?


Lionel van den Berg wrote:[color=blue]
> Victor Bazarov wrote:
>[color=green]
>> "Lionel van den Berg" <charrliebrown@hotmail.com> wrote...
>>[color=darkred]
>>> I'm wondering if there is a diff function like the unix command in C++?[/color]
>>
>>
>>
>> No.
>>
>>[color=darkred]
>>> In fact I would like to know if you can call the unix (I should say
>>> *nix) command from within a c++ application?[/color]
>>
>>
>>
>> Use 'system' function. RTFM.
>>
>>[color=darkred]
>>> 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?[/color]
>>
>>
>>
>> Yes, use 'system' function. Also, search the newsgroup archives for the
>> keywords "system function C++". You will see more recommendations, I am
>> sure.[/color]
>
>
> Great, thanks to both excellent and incredibly prompt responses :).
>
> Lionel.[/color]

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

Tom
Victor Bazarov
Guest
 
Posts: n/a
#6: Jul 23 '05

re: diff command?


Thomas Maier-Komor wrote:[color=blue]
> [...]
> 'popen' might even better fit your needs...[/color]

'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.
Ron House
Guest
 
Posts: n/a
#7: Jul 23 '05

re: diff command?


Victor Bazarov wrote:[color=blue]
> Thomas Maier-Komor wrote:
>[color=green]
>> [...]
>> 'popen' might even better fit your needs...[/color]
>
>
> '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.[/color]

It's a posix standard.

--
Ron House house@usq.edu.au
http://www.sci.usq.edu.au/staff/house
Closed Thread