Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: program bug
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 31 of 36 Topic 26044 of 26955
Post > Topic >>

Re: program bug

by vippstar@[EMAIL PROTECTED] May 3, 2008 at 09:01 AM

On May 3, 6:52 pm, "Bill Cunningham" <nos...@[EMAIL PROTECTED]
> wrote:
> "user923005" <dcor...@[EMAIL PROTECTED]
> wrote in message
>
>
news:6f66a742-0b5b-4e16-b314-dc5e818b6cf0@[EMAIL PROTECTED]
>
>
>
> > #include <stdio.h>
>
> > int main(int argc, char **argv) {
> > char *b;
> > int a;
> > FILE *ifp,*ofp;
> > if (argc!=4) {
> > fprintf(stderr,"usage error\n");
> > return -1;
> > }
> > if (argv[1]=="b") {
> > b="rb";
> > }
> > if (argv[1]=="t") {
> > b="rt";
> > }
> > if (argv[1]!="t"||argv[1]!="b") {
> > fprintf(stderr,"mode error\n");
> > return -1;
> > }
> > if ((ifp=fopen(argv[2],b))==0) {
> > fprintf(stderr,"open error i\n");
> > return -1;
> > }
> > if ((ofp=fopen(argv[3],b))==0) {
> > fprintf(stderr,"open error o\n");
> > return -1;
> > }
> > while(a!=EOF)
> > a=fgetc(ifp);
> > fputc(a,ofp);
> > printf("done\n");
> > return 0;}
>
> > Is anyone good enough to glance at this and see what's wrong?
>
> Too many things for a glance.  It requires a perusal.
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int             main(int argc, char **argv)
> {
>     char           *imode = 0;
>     char           *omode = 0;
>     char            option;
>     int             ch = 0;
>
>     FILE           *ifp,
>                    *ofp;
>     if (argc != 4) {
>         fprintf(stderr, "usage error\n");
>         return EXIT_FAILURE;
>     }
>     option = *argv[1];
>     if (option == 'b') {
>         imode = "rb";
>         omode = "wb";
>     }
>     if (option == 't') {
>         /* This may or may not do something useful on your system */
>         /* The 't' in the mode is not ****table, but is a fairly   */
>         /* popular extension for text mode.                       */
>         imode = "rt";
>         omode = "wt";
Hahah, what else will the troll come up with? You're entertaining, but
it's sad that posters take you seriously.
 




 36 Posts in Topic:
program bug
"Bill Cunningham&quo  2008-05-02 21:40:19 
Re: program bug
"Bill Cunningham&quo  2008-05-02 21:53:34 
Re: program bug
Robert Gamble <rgamble  2008-05-02 15:08:03 
Re: program bug
Robert Gamble <rgamble  2008-05-02 15:05:58 
Re: program bug
"Bill Cunningham&quo  2008-05-02 22:16:27 
Re: program bug
CBFalconer <cbfalconer  2008-05-02 18:47:28 
Re: program bug
"Bill Cunningham&quo  2008-05-02 22:21:04 
Re: program bug
Robert Gamble <rgamble  2008-05-02 15:28:04 
Re: program bug
"Bill Cunningham&quo  2008-05-03 20:42:30 
Re: program bug
Keith Thompson <kst-u@  2008-05-03 14:48:48 
Re: program bug
"Bill Cunningham&quo  2008-05-03 22:58:24 
Re: program bug
Keith Thompson <kst-u@  2008-05-03 18:08:44 
Re: program bug
"Default User"   2008-05-04 03:20:33 
Re: program bug
Keith Thompson <kst-u@  2008-05-03 21:17:13 
Re: program bug
"Default User"   2008-05-04 19:03:07 
Re: program bug
vippstar@[EMAIL PROTECTED  2008-05-03 16:21:48 
Re: program bug
CBFalconer <cbfalconer  2008-05-03 20:29:01 
Re: program bug
Joe Wright <joewwright  2008-05-02 18:25:33 
Re: program bug
Ian Collins <ian-news@  2008-05-03 10:28:17 
Re: program bug
"Bill Cunningham&quo  2008-05-02 22:36:04 
Re: program bug
Robert Gamble <rgamble  2008-05-02 15:36:31 
Re: program bug
Ian Collins <ian-news@  2008-05-03 11:31:53 
Re: program bug
Joe Wright <joewwright  2008-05-02 20:18:17 
Re: program bug
Ian Collins <ian-news@  2008-05-03 12:31:09 
Re: program bug
"Bill Cunningham&quo  2008-05-02 23:15:17 
Re: program bug
Keith Thompson <kst-u@  2008-05-02 23:56:46 
Re: program bug
Richard Heathfield <rj  2008-05-03 07:04:24 
Re: program bug
CBFalconer <cbfalconer  2008-05-02 18:50:15 
Re: program bug
user923005 <dcorbit@[E  2008-05-02 21:25:53 
Re: program bug
"Bill Cunningham&quo  2008-05-03 15:52:27 
Re: program bug
vippstar@[EMAIL PROTECTED  2008-05-03 09:01:52 
Re: program bug
Eligiusz Narutowicz<el  2008-05-04 08:41:56 
Re: program bug
"Bill Cunningham&quo  2008-05-04 21:25:27 
Re: program bug
Barry Schwarz <schwarz  2008-05-04 15:20:34 
Re: program bug
"Bill Cunningham&quo  2008-05-06 02:30:36 
Re: program bug
Nick Keighley <nick_ke  2008-05-06 02:28:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 2:34:12 CDT 2008.