Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

7 May, 2024: fms is rebuilding. Don't expect much in that section for quite a few days, maybe longer.


devel / comp.os.ms-windows.programmer.win32 / ReadFile - how to detect EOF ?

SubjectAuthor
* ReadFile - how to detect EOF ?R.Wieser
`* Re: ReadFile - how to detect EOF ?Christian Astor
 `* Re: ReadFile - how to detect EOF ?R.Wieser
  `* Re: ReadFile - how to detect EOF ?holyghost
   `- Re: ReadFile - how to detect EOF ?R.Wieser

1
ReadFile - how to detect EOF ?

<s7rh1o$1b8k$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=171&group=comp.os.ms-windows.programmer.win32#171

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: ReadFile - how to detect EOF ?
Date: Sun, 16 May 2021 18:25:25 +0200
Organization: Aioe.org NNTP Server
Lines: 23
Message-ID: <s7rh1o$1b8k$1@gioia.aioe.org>
NNTP-Posting-Host: wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org
X-Complaints-To: abuse@aioe.org
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Sun, 16 May 2021 16:25 UTC

Hello all,

I'm reading a file synchronously and non-overlapped using ReadFile. I'm
also reading the file blockwise, and do not want to deal with an empty block
when the filesize turns out to be an exact multiple of the blocksize (every
block must contain data).

IOW, how do I detect the EOF /without/ trying to use ReadFile and getting
zero bytes back.

I've tried a ReadFile of zero bytes, but that doesn't quite work. :-\

I can ofcourse get and store the filesize beforehand and for each block
subtract the ammount of bytes read, but that means I have duplicate data :
a file that ends and a counter that /should/ than be zero. Which I would
rather not have.

I've ofcourse already DDGed the intarwebz for a hint, but have had not luck.

Regards,
Rudy Wieser

Re: ReadFile - how to detect EOF ?

<s8to1d$1i14$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=177&group=comp.os.ms-windows.programmer.win32#177

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!47jZ8yXbWXV7kuM4CaIY1Q.user.gioia.aioe.org.POSTED!not-for-mail
From: castorix@club-internet.fr (Christian Astor)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: ReadFile - how to detect EOF ?
Date: Sat, 29 May 2021 17:53:19 +0200
Organization: Aioe.org NNTP Server
Lines: 29
Message-ID: <s8to1d$1i14$1@gioia.aioe.org>
References: <s7rh1o$1b8k$1@gioia.aioe.org>
NNTP-Posting-Host: 47jZ8yXbWXV7kuM4CaIY1Q.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
X-Notice: Filtered by postfilter v. 0.9.2
 by: Christian Astor - Sat, 29 May 2021 15:53 UTC

You can see MSDN :
https://docs.microsoft.com/en-us/windows/win32/fileio/testing-for-the-end-of-a-file

R.Wieser a écrit :
> Hello all,
>
> I'm reading a file synchronously and non-overlapped using ReadFile. I'm
> also reading the file blockwise, and do not want to deal with an empty block
> when the filesize turns out to be an exact multiple of the blocksize (every
> block must contain data).
>
> IOW, how do I detect the EOF /without/ trying to use ReadFile and getting
> zero bytes back.
>
> I've tried a ReadFile of zero bytes, but that doesn't quite work. :-\
>
> I can ofcourse get and store the filesize beforehand and for each block
> subtract the ammount of bytes read, but that means I have duplicate data :
> a file that ends and a counter that /should/ than be zero. Which I would
> rather not have.
>
> I've ofcourse already DDGed the intarwebz for a hint, but have had not luck.
>
> Regards,
> Rudy Wieser
>
>

Re: ReadFile - how to detect EOF ?

<s8tplo$cdn$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=178&group=comp.os.ms-windows.programmer.win32#178

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: ReadFile - how to detect EOF ?
Date: Sat, 29 May 2021 18:20:55 +0200
Organization: Aioe.org NNTP Server
Lines: 16
Message-ID: <s8tplo$cdn$1@gioia.aioe.org>
References: <s7rh1o$1b8k$1@gioia.aioe.org> <s8to1d$1i14$1@gioia.aioe.org>
NNTP-Posting-Host: wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.9.2
X-MSMail-Priority: Normal
X-RFC2646: Format=Flowed; Response
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Sat, 29 May 2021 16:20 UTC

Christian,

> You can see MSDN :
> https://docs.microsoft.com/en-us/windows/win32/fileio/testing-for-the-end-of-a-file

Yeah, I found that too. The problem with it is that you *have to read data*
to be able to detect there isn't any more of it.

IOW, if I want to mark the current full block of data as the last one I must
have already read (some of) the next block able to determine the EOF status.
And thats something I'd rather not do.

Regards,
Rudy Wieser

Re: ReadFile - how to detect EOF ?

<614d4a1f$0$694$14726298@news.sunsite.dk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=223&group=comp.os.ms-windows.programmer.win32#223

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Fri, 24 Sep 2021 05:46:35 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:91.0) Gecko/20100101
Thunderbird/91.1.1
Reply-To: hackingDOTjohan@yahooDOTcom
Subject: Re: ReadFile - how to detect EOF ?
Content-Language: en-US
Newsgroups: comp.os.ms-windows.programmer.win32
References: <s7rh1o$1b8k$1@gioia.aioe.org> <s8to1d$1i14$1@gioia.aioe.org>
<s8tplo$cdn$1@gioia.aioe.org>
From: automn.willow@gmail.com (holyghost)
Organization: Brandywine Software
In-Reply-To: <s8tplo$cdn$1@gioia.aioe.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 31
Message-ID: <614d4a1f$0$694$14726298@news.sunsite.dk>
NNTP-Posting-Host: 23bfefd4.news.sunsite.dk
X-Trace: 1632455199 news.sunsite.dk 694 automn.willow@gmail.com/109.136.39.83:29835
X-Complaints-To: staff@sunsite.dk
 by: holyghost - Fri, 24 Sep 2021 03:46 UTC

On 5/29/2021 6:20 PM, R.Wieser wrote:
> Christian,
>
>> You can see MSDN :
>> https://docs.microsoft.com/en-us/windows/win32/fileio/testing-for-the-end-of-a-file
>
> Yeah, I found that too. The problem with it is that you *have to read data*
> to be able to detect there isn't any more of it.
>
> IOW, if I want to mark the current full block of data as the last one I must
> have already read (some of) the next block able to determine the EOF status.
> And thats something I'd rather not do.
>
> Regards,
> Rudy Wieser
>
>

Maybe use streams and the "<<", ">>" operators. Then by reading your
previous posts buy K&R (ANSI C) and Strousstrup (The C++ programming
language) books. It will help you a lot.

holly

--
(__)
oo )
|_/\

My Software & Art company (donations are welcome) :
https://ko-fi.com/brandywine9

Re: ReadFile - how to detect EOF ?

<sik67i$1d13$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=224&group=comp.os.ms-windows.programmer.win32#224

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: ReadFile - how to detect EOF ?
Date: Fri, 24 Sep 2021 11:21:08 +0200
Organization: Aioe.org NNTP Server
Lines: 10
Message-ID: <sik67i$1d13$1@gioia.aioe.org>
References: <s7rh1o$1b8k$1@gioia.aioe.org> <s8to1d$1i14$1@gioia.aioe.org> <s8tplo$cdn$1@gioia.aioe.org> <614d4a1f$0$694$14726298@news.sunsite.dk>
Injection-Info: gioia.aioe.org; logging-data="46115"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
X-Notice: Filtered by postfilter v. 0.9.2
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
 by: R.Wieser - Fri, 24 Sep 2021 09:21 UTC

holyghost,

> Maybe use streams and the "<<", ">>" operators.

Alas, I'm not using C{something}to program in.

Regards,
Rudy Wieser

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor