|
From: vasanthsena x <vas...@ya...> - 2003-09-29 17:11:44
|
Hi Reid, EOF == Ctrl-d. when I do that my window closes..Also why should I include <stdlib.h>? I ran your program too.It doesnt work either... Thanks, S. --- Reid Thompson <Rei...@at...> wrote: > #include <stdio.h> > #include <stdlib.h> > > main() > { > int c,nl=0; > > while (( c= getchar()) != EOF) > { > } > ++nl; > printf("%d\n",nl); > system("PAUSE"); > return 0; > > > } > > else you will get number of characters entered > rather than number of > lines > > reid > > > > -----Original Message----- > > From: vasanthsena x [mailto:vas...@ya...] > > > Sent: Monday, September 29, 2003 12:40 PM > > To: dev...@li... > > Subject: [Dev-C++] Newbie Question. > > > > > > Can Someone tell me how getchar() and EOF work on > Dev > > C++. I have written the following program to count > # > > of lines. > > > > #include <stdio.h> > > main() > > { > > int c,nl=0; > > > > while (( c= getchar()) != EOF) > > ++nl; > > printf("%d\n",nl); > > system("PAUSE"); > > return 0; > > > > > > } > > > > > > now before I get any output the screen > disappears.As > > you can see I have included system("PAUSE"); > > > > > > > > __________________________________ > > Do you Yahoo!? > > The New Yahoo! Shopping - with improved product > search > > http://shopping.yahoo.com > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: > http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |