aspose file tools*
The moose likes Other Languages and the fly likes What does EOF mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "What does EOF mean?" Watch "What does EOF mean?" New topic
Author

What does EOF mean?

Ankur Jain Kothari
Ranch Hand

Joined: Feb 08, 2010
Posts: 154


this is the code...which i got from the net....but i dont seem to understand it..what does EOF mean here? and what is the ideal output here?

this code is supposed to count the number of words

thanks


Do What You Wanna Be....Taking Things The Way They Come
scjp 1.6 91 percent, scmad 90 percent(rounded off to nearest integer)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

end of file


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ankur Jain Kothari
Ranch Hand

Joined: Feb 08, 2010
Posts: 154
so when i run this program i get a console window which never seems to stop...i want to stop the input as soon enter is pressed...how do i do it?
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
EOF is a constant that is defined in the stdio.h file and used for the end of file value. For more Google can help.

A decent google hit
Ankur Jain Kothari
Ranch Hand

Joined: Feb 08, 2010
Posts: 154
what happens if ctrl-d is pressed? i dont get any different answer...just a new character...but nothing happens becuase of it
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
If I remember correctly, and I probably don't, EOF is ctrl-D on Mac and *nix, but ctrl-Z or ctrl-Z/return on Windows and DOS.
isha krishnan
Ranch Hand

Joined: Nov 10, 2008
Posts: 50
hi all!!

now if we check the value of EOF inn stdio.h,its -1..
when i type characters on console which are read by getchar()..if i enter -1 in that string eg "abc-1dd"

i get the output with putchar(c) as abc-1dd.

why does not it stop at -1 itself since (-1 = EOF)?

thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61229
    
  66

Did you enter an end-of-file character?
isha krishnan
Ranch Hand

Joined: Nov 10, 2008
Posts: 50
i had not entered character,now i tried with ctrl+z on output window .It helped to get out of output screen and counted the number of lines correctly.

Thanks
Riiya Dsesuja
Greenhorn

Joined: Aug 31, 2012
Posts: 3
EOF is "End Of File"


Try our Restaurants or Order Pizza Online
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What does EOF mean?