473,770 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unix C programming for finding file

Hi all,
I am now working on a C program under Unix.
The requirement for the program is that:
A file name is passed to program as a parameter. The program will
Find files under a specified directory. The matched file must have the
same content with the given file. It does not matter whether the
filenames are the same.

It is easy to find file that has the same name with given file, but
may be hard to find the files that with the same content. In my
knowledge, i give two solutions:

1) Go throught the directory and its sub direcotry tree, and when
meeting a file, Use the stand C library function to open that file and
the given file, and then compare those contents in buffers to see if
they are the same.

2) Go through the directory and its sub deirectroy tree, and when
meeting a file, execute the system shell command "diff" to compare the
two files to see if they are the same in content.
The two solutions seems not very smart and they are very running
slowly. I wonder if there is any library function that can compare two
file contents just like "strcmp" to compare two string.
Or maybe there are some other smart ways to achieve it.

Thank you for suggestions.
Nov 14 '05
46 2538
Richard Bos wrote:
Mark McIntyre <ma**********@s pamcop.net> wrote:

On Thu, 25 Nov 2004 21:20:55 +0000, in comp.lang.c ,
fa*********** *************** *@peace.com wrote:

Are you a yank ?


Dan is swiss or german,

Rumanian, surely?

Richard


Romanian.

Today's French and English texts refer to Romania while older German
seems to like Rumania. What's the difference?

How does Dan spell it?
--
Joe Wright mailto:jo****** **@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #11
In <S8************ ********@comcas t.com> Joe Wright <jo********@com cast.net> writes:
Richard Bos wrote:

Rumanian, surely?

Richard
Romanian.

Today's French and English texts refer to Romania while older German
seems to like Rumania. What's the difference?


"Rumania" and "Roumania" are a obsolete English spellings. "Romania"
is the current official English spelling. The French use "Roumanie"
and the Germans "Rumaenien" ("Rumänien" for people using Latin-1
fonts). The international abbreviation is RO, BTW.
How does Dan spell it?


When using a Latin-1 or Latin-2 font and writing in my native language:
"România".

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
Nov 14 '05 #12
In article <co**********@s unnews.cern.ch> , Dan Pop <Da*****@cern.c h> wrote:
"Rumania" and "Roumania" are a obsolete English spellings. "Romania"
is the current official English spelling.


I wasn't aware that we had official spellings in English.

Do you mean it's the one that the Romanian government wants us to use?

-- Richard
Nov 14 '05 #13

"Richard Tobin" <ri*****@cogsci .ed.ac.uk> wrote in message
news:co******** ***@pc-news.cogsci.ed. ac.uk...
I wasn't aware that we had official spellings in English.


We do. In fact, there have been entire books -- called "dictionari es" -- on
the subject.
Nov 14 '05 #14
In article <p0************ ********@news20 .bellglobal.com >,
Craig Barkhouse <ca******@stude nt.cs.uwaterloo .ca> wrote:
I wasn't aware that we had official spellings in English.
We do. In fact, there have been entire books -- called "dictionari es" -- on
the subject.


How strange. I was not aware that they had an "official" status at all.

-- Richard
Nov 14 '05 #15
On Fri, 26 Nov 2004 07:41:50 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:
Mark McIntyre <ma**********@s pamcop.net> wrote:
On Thu, 25 Nov 2004 21:20:55 +0000, in comp.lang.c ,
fa************* **************@ peace.com wrote:
>Are you a yank ?


Dan is swiss or german,


Rumanian, surely?


same difference.

gd&rvf
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >
Nov 14 '05 #16
Richard Tobin wrote:
In article <p0************ ********@news20 .bellglobal.com >,
Craig Barkhouse <ca******@stude nt.cs.uwaterloo .ca> wrote:

I wasn't aware that we had official spellings in English.


We do. In fact, there have been entire books -- called "dictionari es" -- on
the subject.

How strange. I was not aware that they had an "official" status at all.

-- Richard


It's the Queen's English isn't it? How 'official' do you want it?
But seriously, it doesn't matter how the British, the French, the
Russians or anybody else spells it. How is it spelled in Bucharest?

--
Joe Wright mailto:jo****** **@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #17
On Fri, 26 Nov 2004 21:21:10 -0500, in comp.lang.c , Joe Wright
<jo********@com cast.net> wrote:
Richard Tobin wrote:
In article <p0************ ********@news20 .bellglobal.com >,
Craig Barkhouse <ca******@stude nt.cs.uwaterloo .ca> wrote:
I wasn't aware that we had official spellings in English.

We do. In fact, there have been entire books -- called "dictionari es" -- on
the subject.


How strange. I was not aware that they had an "official" status at all.


It's the Queen's English isn't it? How 'official' do you want it?


Exactly. There's no "legal" spelling of most words, but there is an
official one - for english English, the OED's spelling is as official as it
gets, and its the one you;ll get taught in school. US English probably has
several different competing standards, as seems to be commonplace in other
walks of life there.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >
Nov 14 '05 #18
Dan Pop <Da*****@cern.c h> scribbled the following:
In <S8************ ********@comcas t.com> Joe Wright <jo********@com cast.net> writes:
How does Dan spell it?
When using a Latin-1 or Latin-2 font and writing in my native language:
"România".


Interesting, how is that pronounced?

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"Normal is what everyone else is, and you're not."
- Dr. Tolian Soran
Nov 14 '05 #19
Joona I Palaste wrote:
Dan Pop <Da*****@cern.c h> scribbled the following:
In <S8************ ********@comcas t.com> Joe Wright <jo********@com cast.net> writes:
How does Dan spell it?


When using a Latin-1 or Latin-2 font and writing in my native language:
"România".

Interesting, how is that pronounced?


Like its spelled. The circumflex over the â flattens the a sound
some. We (English speaking) might be otherwise say ro.MAIN.ya rather
than the desired ro.MAHN.ya. That's just a quess of course.

Dan?
--
Joe Wright mailto:jo****** **@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #20

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

Similar topics

270
3990
by: Jatinder | last post by:
I found these questions on a web site and wish to share with all of u out there,Can SomeOne Solve these Porgramming puzzles. Programming Puzzles Some companies certainly ask for these things. Specially Microsoft. Here are my favorite puzzles. Don't send me emails asking for the solutions.
5
2729
by: jrefactors | last post by:
when people say unix programmer, does it mean they write programs in unix environment,and those programs are run in unix platform? it is not necessary they are using unix function calls? I heard most of the time unix programmers are C and C++ programmers. please advise. thanks!!
48
2604
by: Daniel Rudy | last post by:
Hello, On a x86 machine, what is the format of a pointer in C? I know for a fact that the x86 p-mode uses a /selector:offset/ notation where the selector is defined in either the GDT or LDT. Does that carry over into the pointer, or does Unix use the flat memory model? -- Daniel Rudy
6
16392
by: Joseph | last post by:
Hi, I am trying to develop a C# application that will run on Windows that will do the following * Select file name to process * FTP the file to a UNIX server * Process this file on UNIX using a program on UNIX "./pgmname -options Infilename > OutputFilename" * FTP the output of this program back to Windows * Process the resultant file and create output report file
4
2371
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of which I mean here. Just for a moment, let's just take one definition for one of the
7
2069
by: programming | last post by:
Hi all, i have been having trouble with a login script that works on my windows machine, however when i upload it to the Unix server through VPN, the same script won't work! It won't parse member.txt properly i think. The password and usernames i am using are at the bottom of this post. Each time i go to login on the unix server, it clears the username and password field. I have been attempting to solve the problem, but have been...
2
1596
by: frikk | last post by:
Hey everyone, (Sorry about the first message if it made it - i got cut off early). I have a homework problem for my Operating Systems class. I am supposed to use a command such as "ps -aux" and return "N number of users, M number of processes". How am I to go about doing this? I am not very familiar with string parsing in c++, is this the only way? I am talking about getting the output from "ps -aux" and parsing it to retrieve the...
21
3038
by: Tom Gur | last post by:
Hi, It's seems that csh and tcsh acts a bit different when handling special characters in quotes. i.e: if i'll supply my program with the following arguments: -winpath "c:\\temp\\" tcsh will take it as -winpath "c:\temp\" and csh will take it literally (with the double-slashes). Is there a way for me to know what shell is currently running my
65
5101
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but got errors of Failed to open file ./outdir/mytestout.txt. Below is the code: #include <stdio.h>
0
9618
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
10259
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
10101
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
10038
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
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6710
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.