473,769 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

diff command?

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
6 4491
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
"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
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
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
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
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.a u
http://www.sci.usq.edu.au/staff/house
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3683
by: Guillaume Lahitette | last post by:
Hello everyone, I am looking for a lightweight Java Applet to diff and merge two text files. The functionality would be a subset of what WinMerge (http://winmerge.sourceforge.net) offers: - diff 2 text files - merge (in both directions) - color coding to highlight differences I found some Java diff tools but they were all command line. And my
8
2799
by: TonyHa | last post by:
Hello, Does any one have using Python to write a Unix "diff" command for Window? Tony Ha.
0
1402
by: sfsfsfsf | last post by:
SchemaCrawler is a new schema diff tool on Sourceforge. http://sourceforge.net/projects/schemacrawler It can display the schema in a text format (plain text, CSV, or HTML), designed for diff-ing. This is especially useful in diff-ing an older and newer version of a schema. It is written in Java (platform independent), and runs from the command line, or as an ant task.
2
2742
by: Steve Manes | last post by:
My company offers an ASP service for advertising companies using PG. For contractual reasons, each client gets its own replicated database. This presents a problem whenever a new feature/fix requires a DDL change which must be rolled out across N databases. Currently, we keep track of these changes via a central text file in CVS with manually entered DDL updates. The problem is making sure that overworked developers actually log all these...
9
6520
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the delta binary is pretty huge in size. I have 1 byte file and 2 bytes file, the delta should be 1 byte but somehow it turns out to be 249 bytes using binary formatter. I guess serialization has some other things added to the delta file.
6
6456
by: Igor Shevchenko | last post by:
Hi! Suppose I have "pg_dump -s" of two pg installs, one is "dev", another is "production". Their schemas don't differ too much, and I want to get a "diff -u"-like schema diff so I can quickly add missing/remove old tables/sequences/etc to one or another (manually). Is there some quick tool for doing this ? There was a thread about it sometime in aug, 2002, but it ended without producing anything useful.
4
4955
by: Andreas Kasparek | last post by:
Hola! I'm preparing my master thesis about a XML Merge Tool implementation and was wondering if there is any open standard for XML diff regarding topics like: - is a diff result computed on the ordered or unordered xml node tree of the compared documents? - what identifiers/criteria should be used by default to match elements of the same type in different documents? - should a diff tool consider move operations or only insert/delete
3
3011
by: AirYT | last post by:
Hello, I'm looking for an implementation for diffing 2 (text) files and spitting out the output using php only. i would like to extend this to use ftp to diff two files on two ftp servers, or one local file & a remote ftp server. Anyone have any ideas on source for this before i go ahead and build it? At least the diff engine? a nice gui would be best, but not totally necessary. TIA,
4
3834
snowfall
by: snowfall | last post by:
I need to find the difference of two files and save it in third file and process it.. But the outpur of diff command is coming with the 'line number - difference' code. Eg of my output i22,26d21 < Use the bc program to convert from decimal to hexadecimal. < To do so, use the obase command to set the base for output: 39c34,35 < See Section 5.6 for more examples of using bc.
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.