Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Uno <Uno@example.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: bdiff |
| Date | 2011-06-09 13:19 -0600 |
| Message-ID | <95ckn0Fg9bU1@mid.individual.net> (permalink) |
| References | (4 earlier) <95aup2FneqU1@mid.individual.net> <95av9fFrnrU11@mid.individual.net> <95b018FvdmU1@mid.individual.net> <95bg72Fjo2U1@mid.individual.net> <isq2mv$c6h$1@speranza.aioe.org> |
On 06/09/2011 03:10 AM, Janis Papanagnou wrote:
> The compiler doesn't know what your intention was; it's irrelevant
> how many statements you have. Fix your syntax.
Thx, janis. I have it syntactical now, but the behavior has a ways to
come. Why does my program think that the first byte's are differing,
while the unix command thinks that only occurs much later:
$ cc -Wall -Wextra cmp4.c -o cmp
$ ./cmp
Ungleich: 1
c and d are 48 and 134514059
Counter reached 1
$ cmp shoulder.wmv downloaded1.wmv
shoulder.wmv downloaded1.wmv differ: byte 196502, line 1409
$ cat cmp4.c
#include <stdio.h>
int main(void)
{
int c, d;
long counter = 0;
FILE *fp, *fq;
fp = fopen("shoulder.wmv", "rb+");
fq = fopen("downloaded1.wmv", "rb+");
while (((c = fgetc(fp)) != EOF) || ((d = fgetc(fq)) != EOF)) {
counter++;
if (counter == 10000) {
printf("int is %d\n", c);
}
if (c != d) {
printf("Ungleich: %ld\n", counter);
printf("c and d are %d and %d\n", c, d);
break;
}
}
printf("Counter reached %ld\n", counter);
fclose(fp);
return 0;
}
// cc -Wall -Wextra cmp4.c -o cmp
$
>
> BTW, why are you posting this to comp.unix.shell?
>
*nix is my platform, and whenever I'm cooking up a project with a
programming language, I hit at least one big gotcha with the OS. Also,
I'm trying to imitate the functionality of cmp somewhat.
Are you suggesting that another unix group might be more appropriate?
--
Uno
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
variable-length strings Uno <Uno@example.invalid> - 2011-06-01 03:36 -0600
Re: variable-length strings ccc31807 <cartercc@gmail.com> - 2011-06-01 07:13 -0700
Re: variable-length strings Uno <Uno@example.invalid> - 2011-06-02 10:54 -0600
Re: variable-length strings "George Mpouras" <nospam.gravitalsun@hotmail.com.nospam> - 2011-06-01 17:01 +0300
Re: variable-length strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2011-06-02 15:33 +0200
Re: variable-length strings "Peter J. Holzer" <hjp-usenet2@hjp.at> - 2011-06-02 15:44 +0200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-08 21:59 -0600
Re: bdiff Ian Collins <ian-news@hotmail.com> - 2011-06-09 16:08 +1200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-08 22:20 -0600
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 02:57 -0600
Re: bdiff Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-06-09 11:10 +0200
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 13:19 -0600
Re: bdiff James Waldby <not@valid.invalid> - 2011-06-09 19:32 +0000
Re: bdiff Angel <angel+news@spamcop.net> - 2011-06-09 19:32 +0000
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 15:28 -0600
Re: bdiff blp@cs.stanford.edu (Ben Pfaff) - 2011-06-09 12:33 -0700
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 15:15 -0600
Re: bdiff pacman@kosh.dhis.org (Alan Curry) - 2011-06-09 22:17 +0000
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:14 +0000
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-20 18:43 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:39 +0000
Re: bdiff Joe Wright <joewwright@comcast.net> - 2011-06-21 18:38 -0400
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-21 18:11 -0500
Re: bdiff Michael Press <rubrum@pacbell.net> - 2011-06-22 15:51 -0700
Re: bdiff Stephen Sprunk <stephen@sprunk.org> - 2011-06-21 07:49 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:40 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-22 09:59 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 19:57 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-23 21:16 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-24 19:36 +0000
Re: bdiff superpollo <superpollo@tznvy.pbz> - 2011-06-24 22:48 +0200
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-24 21:17 +0000
Re: bdiff Robert Wessel <robertwessel2@yahoo.com> - 2011-06-24 17:20 -0500
Re: bdiff blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 19:55 +0000
Re: bdiff Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-21 21:40 -0400
Re: bdiff Azazel <azazel@remove.azazel.net> - 2011-06-22 09:06 -0500
Re: bdiff Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-06-22 16:47 +0100
Re: bdiff Stephen Sprunk <stephen@sprunk.org> - 2011-06-22 11:23 -0500
Re: bdiff Ike Naar <ike@sverige.freeshell.org> - 2011-06-09 21:37 +0000
Re: bdiff bonomi@host122.r-bonomi.com (Robert Bonomi) - 2011-06-19 06:10 -0500
Re: bdiff Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-09 07:13 -0400
Re: bdiff Uno <Uno@example.invalid> - 2011-06-09 13:30 -0600
Re: bdiff Keith Thompson <kst-u@mib.org> - 2011-06-09 13:29 -0700
Re: bdiff Uno <merrilljensen@q.com> - 2011-06-09 21:11 -0700
Re: bdiff "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-06-09 23:58 -0400
Re: bdiff Uno <Uno@example.invalid> - 2011-06-12 00:47 -0600
Re: bdiff Angel <angel+news@spamcop.net> - 2011-06-12 07:53 +0000
Re: bdiff Shao Miller <sha0.miller@gmail.com> - 2011-06-12 12:02 -0500
Re: bdiff Keith Thompson <kst-u@mib.org> - 2011-06-12 01:24 -0700
Re: bdiff Shao Miller <sha0.miller@gmail.com> - 2011-06-12 12:18 -0500
csiph-web