From: Walter Harms <wharms@bfs.de>
To: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Cc: "mtk.manpages@gmail.com" <mtk.manpages@gmail.com>,
"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: AW: [PATCH] fread.3: Add example
Date: Thu, 18 Jun 2020 14:47:54 +0000 [thread overview]
Message-ID: <80edb808679e48cc905421345c249127@bfs.de> (raw)
In-Reply-To: <20200618133647.rq2w6lanuatoweri@comp.lan>
________________________________________
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).
perhaps you can support what want to show with a
printf("pos=%ld\n",ftell(fp));
before and after read.
hope that helps,
re,
wh
--
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
next prev parent reply other threads:[~2020-06-18 14:48 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 ` Walter Harms [this message]
2020-06-18 19:01 ` Arkadiusz Drabczyk
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=80edb808679e48cc905421345c249127@bfs.de \
--to=wharms@bfs.de \
--cc=arkadiusz@drabczyk.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/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