Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   How to stop reading a file? (http://www.velocityreviews.com/forums/t440702-how-to-stop-reading-a-file.html)

siliconwafer 12-30-2005 12:06 PM

How to stop reading a file?
 
Hi All,
I want to know tht how can one Stop reading a file in C (e.g a Hex
file)with no 'EOF'?


Arne Schmitz 12-30-2005 12:16 PM

Re: How to stop reading a file?
 
siliconwafer wrote:

> I want to know tht how can one Stop reading a file in C (e.g a Hex
> file)with no 'EOF'?


Look up feof().

Arne

--
[--- PGP key FD05BED7 --- http://www.root42.de/ ---]

Chuck F. 12-30-2005 12:27 PM

Re: How to stop reading a file?
 
siliconwafer wrote:
>
> I want to know tht how can one Stop reading a file in C (e.g a
> Hex file)with no 'EOF'?


Where did you get such a big disk drive? Who put the endless file
on it? What software did they use. Where did they get the data to
write to the file?

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>

Mark McIntyre 12-30-2005 12:48 PM

Re: How to stop reading a file?
 
On 30 Dec 2005 04:06:09 -0800, in comp.lang.c , "siliconwafer"
<spdandavate@yahoo.com> wrote:

>Hi All,
>I want to know tht how can one Stop reading a file in C (e.g a Hex
>file)with no 'EOF'?


Stop calling fread() ? close the file? :-)


Seriously however, read up on feof().
Mark McIntyre
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Niklas Norrthon 12-30-2005 01:41 PM

Re: How to stop reading a file?
 
"siliconwafer" <spdandavate@yahoo.com> writes:

> Hi All,
> I want to know tht how can one Stop reading a file in C (e.g a Hex
> file)with no 'EOF'?


Reading a file is not addictive, so it's just a matter of not
reading any more from it.

Btw, what do you mean with "with no EOF"? I can think of a few
examples, like /dev/zero and /dev/random on unix systems, is that
what you mean?

/Niklas Norrthon

Eric Sosman 12-30-2005 02:47 PM

Re: How to stop reading a file?
 
Chuck F. wrote:

> siliconwafer wrote:
>
>>
>> I want to know tht how can one Stop reading a file in C (e.g a
>> Hex file)with no 'EOF'?

>
>
> Where did you get such a big disk drive? Who put the endless file on
> it? What software did they use. Where did they get the data to write
> to the file?


He's probably writing a quality-control test program
to make sure /dev/zero contains only zeroes ;-)

--
Eric Sosman
esosman@acm-dot-org.invalid

SM Ryan 12-30-2005 03:23 PM

Re: How to stop reading a file?
 
"siliconwafer" <spdandavate@yahoo.com> wrote:
# Hi All,
# I want to know tht how can one Stop reading a file in C (e.g a Hex
# file)with no 'EOF'?

The system should report to stdio the end of a disk file and stdio
reports that with EOF or NULL returns or feof. For a file like a
serial port or keyboard, you may have to define your own protocol
within the file to work the end.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I ASSURE YOU WE'RE OPEN!

Afifov 12-30-2005 03:28 PM

Re: How to stop reading a file?
 
can u give more details?


Joe Wright 12-30-2005 05:20 PM

Re: How to stop reading a file?
 
Afifov wrote:
> can u give more details?
>

About what? When you read this group, do you pay attention?

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---

Afifov 12-30-2005 07:05 PM

Re: How to stop reading a file?
 
Dear Joe,

I do read in this forum.But i believe that there is a couple of ways to go
around reading a file without the use of eof, either by seeking to end of
file through lseek, or getting size of the file and decrementing a counter
(which would be initialized to file size) until it hits zero.
It depends on the task.

But thanks for the tip.



All times are GMT. The time now is 01:42 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.