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.


|