linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
To: Walter Harms <wharms@bfs.de>
Cc: "mtk.manpages@gmail.com" <mtk.manpages@gmail.com>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: Re: [PATCH] fread.3: Add example
Date: Thu, 18 Jun 2020 21:01:17 +0200	[thread overview]
Message-ID: <20200618190117.tissd5pzvif5jggp@comp.lan> (raw)
In-Reply-To: <80edb808679e48cc905421345c249127@bfs.de>

On Thu, Jun 18, 2020 at 02:47:54PM +0000, Walter Harms wrote:
> 
> ________________________________________
> Von: Arkadiusz Drabczyk [arkadiusz@drabczyk.org]
> Gesendet: Donnerstag, 18. Juni 2020 15:36
> 
> >>
> >> +    ret = fread(buffer, 1, 1, fp);
> >> +    if (ret != 1) {
> >> +        fprintf(stderr, "fread() failed: %zu\en", ret);
> >> +        exit(EXIT_FAILURE);
> >> +    }
> >> +
> >> please drop a line what case you want to explain here, looks like the same as above.
> 
> >As said a few lines above, this retrieves ELF class. I wanted to show
> >that file pointer moves automatically after fread() finishes.
> 
> ok i get the point(s).
> 1. you show you can read an "item" a bunch of bytes
> 
> the second read() should demonstrate that consecutive reads return
>  consecutive blocks of data (here the magic and class id of an ELF).

Exactly.

> perhaps you can support what want to show with a
> printf("pos=%ld\n",ftell(fp));
> before and after read.

Let's what Michael says. If he thinks this suggestion and the entire
example in the first place is a good idea I will add it.

-- 
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>

      reply	other threads:[~2020-06-18 19:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 18:45 [PATCH] fread.3: Add example Arkadiusz Drabczyk
2020-06-18  8:49 ` AW: " Walter Harms
2020-06-18 13:36   ` Arkadiusz Drabczyk
2020-06-18 14:47     ` AW: " Walter Harms
2020-06-18 19:01       ` Arkadiusz Drabczyk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200618190117.tissd5pzvif5jggp@comp.lan \
    --to=arkadiusz@drabczyk.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=wharms@bfs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).