From: "Robert ARSENIUK" To: Subject: Re: whats wrong w/ this code? Date: Thu, 5 Nov 1998 08:28:21 +0100 Message-ID: <01be088d$ddaf3290$0113010a@robi1.jmpolska.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Reply-To: djgpp AT delorie DOT com -----Wiadomość orginalna----- Od: The zr0 Grupy dyskusyjne: comp.os.msdos.djgpp Do: djgpp AT delorie DOT com Data: 5 listopada 1998 05:33 Temat: whats wrong w/ this code? >This has had me puzzled for awhile, its a program designed to replace >the dos"type"command, but allows wildcards > >please email to author...thanx in advance > >#include >#include >#include > >int count=1; >char x; > >int show_file(int count,char *argv[]); > >char *main(int argc, char *argv[]) { > >if(argc<2) > { > fprintf(stderr,"Not enough arguments.\n"); > exit(1); > } > > for(count=2;count { > printf("Count before passing: %d",count); > count++; > show_file(count,argv); > } >return; >} > >int show_file(int count,char *argv[]) { >FILE *in; >printf("\nShow count"); >printf("\n%d\n",count); >puts("show filename"); >printf("\n%s\n",argv[count]); >puts("opening"); >if((in=fopen(argv[count],"r"))==NULL); > { > fprintf(stderr,"Cannot open %s, aborting...\n",argv[count]); > exit(1); > } > puts("starting display"); > > while(!feof(in)) { > x=getc(in); > putchar(x); > } >fclose(in); >return; >} > > > Change loop like this : for(count=2;count