Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #22371 > unrolled thread
| Started by | "billcun@nspam.invalid" <billcun@suddenlink.net> |
|---|---|
| First post | 2012-06-18 13:45 -0700 |
| Last post | 2012-06-20 09:53 -0700 |
| Articles | 12 on this page of 52 — 16 participants |
Back to article view | Back to comp.lang.c
fread/fwrite "billcun@nspam.invalid" <billcun@suddenlink.net> - 2012-06-18 13:45 -0700
Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-19 09:28 +1200
Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-18 17:47 -0400
Re: fread/fwrite billcun@suddenlink.net - 2012-06-18 15:48 -0700
Re: fread/fwrite Ike Naar <ike@iceland.freeshell.org> - 2012-06-18 23:37 +0000
Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-18 21:56 -0400
Re: fread/fwrite billcun@suddenlink.net - 2012-06-19 04:54 -0700
Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-19 09:43 -0400
Re: fread/fwrite billcun@suddenlink.net - 2012-06-19 09:51 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-20 00:05 -0700
Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-20 06:45 -0400
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-20 04:20 -0700
Re: fread/fwrite tom st denis <tom@iahu.ca> - 2012-06-20 07:54 -0700
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:13 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:17 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-19 08:17 -0700
Re: fread/fwrite Mark Bluemel <mark.bluemel@googlemail.com> - 2012-06-20 01:05 -0700
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:17 -0700
Re: fread/fwrite Johannes Bauer <dfnsonfsduifb@gmx.de> - 2012-06-20 17:33 +0200
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:50 -0700
Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 07:45 -0400
Re: fread/fwrite Kenneth Brody <kenbrody@spamcop.net> - 2012-06-20 18:38 -0400
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 15:59 -0700
Re: fread/fwrite "BartC" <bc@freeuk.com> - 2012-06-21 00:24 +0100
Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 11:40 +1200
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 16:47 -0700
Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 11:56 +1200
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:11 -0700
Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 12:28 +1200
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:51 -0700
Re: fread/fwrite Kenneth Brody <kenbrody@spamcop.net> - 2012-06-21 15:05 -0400
Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-22 07:17 +1200
Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 16:01 -0400
Re: fread/fwrite Keith Thompson <kst-u@mib.org> - 2012-06-21 15:08 -0700
Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 18:36 -0400
Re: fread/fwrite Keith Thompson <kst-u@mib.org> - 2012-06-21 16:49 -0700
Re: fread/fwrite Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-21 01:30 +0100
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:51 -0700
Re: fread/fwrite Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-21 02:22 +0100
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-22 00:13 -0700
Re: fread/fwrite tom st denis <tom@iahu.ca> - 2012-06-21 04:22 -0700
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-22 12:14 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:33 -0700
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 16:27 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:21 -0700
Re: fread/fwrite Mark Bluemel <mark.bluemel@googlemail.com> - 2012-06-21 07:17 -0700
Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-22 00:22 -0700
Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-22 12:17 -0700
Re: fread/fwrite John Gordon <gordon@panix.com> - 2012-06-18 22:05 +0000
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 09:03 -0700
Re: fread/fwrite John Gordon <gordon@panix.com> - 2012-06-20 16:28 +0000
Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 09:53 -0700
Page 3 of 3 — ← Prev page 1 2 [3]
| From | tom st denis <tom@iahu.ca> |
|---|---|
| Date | 2012-06-21 04:22 -0700 |
| Message-ID | <7c1e8ae5-e0a8-4199-b0af-8ff5c008b445@x39g2000yqx.googlegroups.com> |
| In reply to | #22451 |
On Jun 20, 7:47 pm, Bill Cunningham <bill...@suddenlink.net> wrote: > On Jun 20, 7:40 pm, Ian Collins <ian-n...@hotmail.com> wrote: > > > As others have pointed out, you have been asking the same or similar > > questions here for many years. > > > Your original question on this thread could easily have been answered > > with a quick search. Quite often the search results for your questions > > include the thread from the previous time(s) you asked it! > > I have read the man pages and googled them many times on fread and > fwrite. I have tried to go by that and failed. That's why I asked for > an example. In other places people readily showed me one with no > problem and I see now what I might have been doing wrong. The man > pages I looked at gave no example. Only parameters and a somewhat > cryptic mention of ferror and feof. I learned how to use fread/fwrite while using Turbo C++ 1.01 [or whatever the heck it was] which came free with a copy of "Type and learn C" that I got when I was 10 [20 some odd years ago...] Are you saying you're not as smart as a ten year old? Tom
[toc] | [prev] | [next] | [standalone]
| From | Bill Cunningham <billcun@suddenlink.net> |
|---|---|
| Date | 2012-06-22 12:14 -0700 |
| Message-ID | <3ac026aa-e97a-468a-a622-2a2bef9e2a5a@l32g2000yqb.googlegroups.com> |
| In reply to | #22476 |
On Jun 21, 7:22 am, tom st denis <t...@iahu.ca> wrote: > On Jun 20, 7:47 pm, Bill Cunningham <bill...@suddenlink.net> wrote: > > > On Jun 20, 7:40 pm, Ian Collins <ian-n...@hotmail.com> wrote: > > > > As others have pointed out, you have been asking the same or similar > > > questions here for many years. > > > > Your original question on this thread could easily have been answered > > > with a quick search. Quite often the search results for your questions > > > include the thread from the previous time(s) you asked it! > > > I have read the man pages and googled them many times on fread and > > fwrite. I have tried to go by that and failed. That's why I asked for > > an example. In other places people readily showed me one with no > > problem and I see now what I might have been doing wrong. The man > > pages I looked at gave no example. Only parameters and a somewhat > > cryptic mention of ferror and feof. > > I learned how to use fread/fwrite while using Turbo C++ 1.01 [or > whatever the heck it was] which came free with a copy of "Type and > learn C" that I got when I was 10 [20 some odd years ago...] > > Are you saying you're not as smart as a ten year old? > > Tom Four years ago? On the Klonopin I was taking... Not as smart as a five year old. B
[toc] | [prev] | [next] | [standalone]
| From | nick_keighley_nospam@hotmail.com |
|---|---|
| Date | 2012-06-21 00:33 -0700 |
| Message-ID | <e89c7122-ac82-4dae-98c9-ada9325f7db9@googlegroups.com> |
| In reply to | #22446 |
On Wednesday, June 20, 2012 11:59:38 PM UTC+1, Bill Cunningham wrote: > On Jun 20, 6:38 pm, Kenneth Brody <kenbr...@spamcop.net> wrote: > > On 6/20/2012 11:17 AM, bill...@suddenlink.net wrote: <snip> > > > I can count on one hand what I've been *taught* on clc. > > > > Perhaps the problem isn't the teacher? > > There is a simple and straight foreward way to put things. Long drawn > out explainations to hobbyists about macro expansion (I know nothing > about) from a PhD's doctoral really don't help. I'm not a computer > scientist. seems like tails we lose heads you win. If we give short answers we're impatient and long answers we're showing off our PhDs. > > > If you want to learn something on clc the response is generally... > > > "GIYF" or "I don't do homework." > > > > I rarely see "GIYF". > > I see it every other response post. that's because you ask very basic questions that would be better answered by reading a basic tutorial. For fuck's sake you failed to recognise a simple array access in this very thread! > To my postings. Also on another > note I have not seen this told to others but I have been in a hurry > and mispelled simple words that are readable and been mocked and > "quickley dropped from tutoring." I don't mock people for mispellings and typos (there's a good reason for that). But to answer question you have to understand it. And you mess up terminology, ask questions you didn't mean to ask (see this thread) and generally play fast and loose with the laws of english language and basic logic. programmer is disiplined thought. you appear to unable to think or to organise yourself. > As I said before I believe there are > alot of serious programmers on this group computer scientists. what language is *that* in. > Patience is not common. you are shown far too much patience at one time I had a list of responses for you. Number one was "work out what you are trying to do". you nearly always fail on that one. So why are you posting here? For fun? <snip>
[toc] | [prev] | [next] | [standalone]
| From | Bill Cunningham <billcun@suddenlink.net> |
|---|---|
| Date | 2012-06-20 16:27 -0700 |
| Message-ID | <0f24fe55-0b94-44c6-8c93-80b05aa365b6@x21g2000vbc.googlegroups.com> |
| In reply to | #22445 |
On Jun 20, 6:38 pm, Kenneth Brody <kenbr...@spamcop.net> wrote: > On 6/20/2012 11:17 AM, bill...@suddenlink.net wrote: > > > On Jun 20, 4:05 am, Mark Bluemel <mark.blue...@googlemail.com> wrote: > >> On Jun 19, 4:17 pm, nick_keighley_nos...@hotmail.com wrote: > [...] > >> I can't decide whether he's a) simply incapable of learning or b) a > >> subtle troll pretending to be a), though I'm beginning to lean towards > >> b). Either way, I don't believe there is much point attempting to > >> teach him. > > > Things are not *taught* on clc. You do not learn anything. > > I have been programming in C for about 29 years, and I've learned things > about C in this group. True, most people would probably consider those > things "obscure", such as why my attempt to #define the name of a header > file wasn't working: > > Compile with "-DMYHEADER=myheader.h" > ... > #include <MYHEADER> > > because of the way "<MYHEADER>" is parsed. Instead, I can use this, which > does work: > > Compile with "-DMYHEADER='<myheader.h>'" > ... > #include MYHEADER I think a typical ask to me for a question like that is "see comp.compilers..." With an impression to me like "I gotta go...The lab is waiting..." > Then there are techniques that are "obvious" in today's C world, but which > weren't consistently available in K&R1 days, and so I often use "antiquated" > means of doing things, simply because that's the way I learned how to do > them. Seeing things mentioned here reminds me at times that there are > better ways of doing things. As for techniques that are obvious in the C world I don't know because I am not in the C world. Nor am I a computer scientist or doing homework to become one. > (I learned C along with the need to write with multiple platforms in mind. > In some ways, starting with the need to support both big-endian 32-bit Unix > systems and little-endian 16-bit MS-DOS systems taught me a lot about > portability. I definitely never had the "all the world's a VAX" attitude.) > > > It is a C social group. > > At times, yes. > > > I can count on one hand what I've been *taught* on clc. > > Perhaps the problem isn't the teacher? > > > If you want to learn something on clc the response is generally... > > "GIYF" or "I don't do homework." > > I rarely see "GIYF". And the "I don't do homework" responses are to people > who don't want to be taught, but rather want to be given the answer, often > to a "problem" that is a typical homework-type assignment. > > > You do not learn C here. You talk > > about it or your experience with C. I've learned more about writing C > > on private mail groups in 1 month more than years on clc. > > No comment. > > -- > Kenneth Brody
[toc] | [prev] | [next] | [standalone]
| From | nick_keighley_nospam@hotmail.com |
|---|---|
| Date | 2012-06-21 00:21 -0700 |
| Message-ID | <a642455f-7a56-49d4-a77a-94320e20e535@googlegroups.com> |
| In reply to | #22438 |
On Wednesday, June 20, 2012 4:17:28 PM UTC+1, Bill Cunningham wrote: > On Jun 20, 4:05 am, Mark Bluemel <mark.blue...@googlemail.com> wrote: > > On Jun 19, 4:17 pm, nick_keighley_nos...@hotmail.com wrote: > > > did you read what he wrote? > > > > Why would you expect Bill to do that? He's been around this group long > > enough for any regular reader to have some idea of his modus operandi. > > > > I can't decide whether he's a) simply incapable of learning or b) a > > subtle troll pretending to be a), though I'm beginning to lean towards > > b). Either way, I don't believe there is much point attempting to > > teach him. > > Things are not *taught* on clc. You do not learn anything. *you* might not. It's a technical news group. if you ask a technical question it's assumed you are interested in the answer! So you're just here to waste our time? It is a C > social group. I can count on one hand what I've been *taught* on clc. that's because you're a cretin > If you want to learn something on clc the response is generally... > "GIYF" or "I don't do homework." You do not learn C here. You talk > about it or your experience with C. I've learned more about writing C > on private mail groups in 1 month more than years on clc. I don't believe you've learnt anything
[toc] | [prev] | [next] | [standalone]
| From | Mark Bluemel <mark.bluemel@googlemail.com> |
|---|---|
| Date | 2012-06-21 07:17 -0700 |
| Message-ID | <7a40d147-0f43-48a8-9360-cdd96efa04fb@m3g2000vbl.googlegroups.com> |
| In reply to | #22463 |
On Jun 21, 8:21 am, nick_keighley_nos...@hotmail.com wrote: > On Wednesday, June 20, 2012 4:17:28 PM UTC+1, Bill Cunningham wrote: > > On Jun 20, 4:05 am, Mark Bluemel <mark.blue...@googlemail.com> wrote: > > > On Jun 19, 4:17 pm, nick_keighley_nos...@hotmail.com wrote: > > > > did you read what he wrote? > > > > Why would you expect Bill to do that? He's been around this group long > > > enough for any regular reader to have some idea of his modus operandi. > > > > I can't decide whether he's a) simply incapable of learning or b) a > > > subtle troll pretending to be a), though I'm beginning to lean towards > > > b). Either way, I don't believe there is much point attempting to > > > teach him. > > > Things are not *taught* on clc. You do not learn anything. > > *you* might not. It's a technical news group. if you ask a technical question > it's assumed you are interested in the answer! So you're just here to waste our time? So it is b)... > > > It is a C > > social group. I can count on one hand what I've been *taught* on clc. > > that's because you're a cretin No - if he's what I'm increasingly inclined to believe he is, then he's rather clever, if somewhat perverse. > > If you want to learn something on clc the response is generally... > > "GIYF" or "I don't do homework." You do not learn C here. You talk > > about it or your experience with C. I've learned more about writing C > > on private mail groups in 1 month more than years on clc. > > I don't believe you've learnt anything He's learnt how to yank your chain. I suggest kill-filing him and updating your kill-file as he mutates his identity.
[toc] | [prev] | [next] | [standalone]
| From | nick_keighley_nospam@hotmail.com |
|---|---|
| Date | 2012-06-22 00:22 -0700 |
| Message-ID | <9ecd27f6-b592-4af4-959b-d7a60857aa8d@googlegroups.com> |
| In reply to | #22484 |
On Thursday, June 21, 2012 3:17:22 PM UTC+1, Mark Bluemel wrote: > On Jun 21, 8:21 am, nick_keighley_nos...@hotmail.com wrote: > > On Wednesday, June 20, 2012 4:17:28 PM UTC+1, Bill Cunningham wrote: > > > On Jun 20, 4:05 am, Mark Bluemel <mark.blue...@googlemail.com> wrote: > > > > On Jun 19, 4:17 pm, nick_keighley_nos...@hotmail.com wrote: <snip> > > > > I can't decide whether he's a) simply incapable of learning or b) a > > > > subtle troll pretending to be a), though I'm beginning to lean towards > > > > b). Either way, I don't believe there is much point attempting to > > > > teach him. > > > > > Things are not *taught* on clc. You do not learn anything. > > > > *you* might not. It's a technical news group. if you ask a technical > > question it's assumed you are interested in the answer! So you're just > > here to waste our time? > > So it is b)... > > > > It is a C social group. I can count on one hand what I've been > > > *taught* on clc. > > > > that's because you're a cretin > > No - if he's what I'm increasingly inclined to believe he is, then > he's rather clever, if somewhat perverse. > > > > If you want to learn something on clc the response is generally... > > > "GIYF" or "I don't do homework." You do not learn C here. You talk > > > about it or your experience with C. I've learned more about writing C > > > on private mail groups in 1 month more than years on clc. > > > > I don't believe you've learnt anything > > He's learnt how to yank your chain. I suggest kill-filing him and > updating your kill-file as he mutates his identity. he certainly has. And someone has kindly posted an example =of mine= from 4 years ago on the use of fread(). So it's not only Bill who is a slow learner with a poor memory! Even if he isn't a troll (as many people have suggested over the years) he has many of their attributes. It was the suggestion that people don't even attempt to be helpful on clc that finally blew the fuse.
[toc] | [prev] | [next] | [standalone]
| From | Bill Cunningham <billcun@suddenlink.net> |
|---|---|
| Date | 2012-06-22 12:17 -0700 |
| Message-ID | <b25383f3-7899-47d2-bd73-02d45f9159cc@j25g2000yqn.googlegroups.com> |
| In reply to | #22519 |
On Jun 22, 3:22 am, nick_keighley_nos...@hotmail.com wrote: > he certainly has. And someone has kindly posted an example =of mine= > from 4 years ago on the use of fread(). So it's not only Bill who is a > slow learner with a poor memory! Even if he isn't a troll (as many > people have suggested over the years) he has many of their attributes. > > It was the suggestion that people don't even attempt to be helpful on > clc that finally blew the fuse.- Hide quoted text - Now that I'm using google groups and figured out how to get Bill Cunningham in the name section I am seeing where people can type in a posters name and get old posts! And btw I have saved your example and I'm studing it. I don't know about 4 years ago but the first thing I wanted to change was insert a do while. I guess I didn't understand that 4 years ago. B
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2012-06-18 22:05 +0000 |
| Message-ID | <jro8ns$5ub$1@reader1.panix.com> |
| In reply to | #22371 |
In <2a2da336-fa08-4bfa-95b4-47f99a126877@googlegroups.com> "billcun@nspam.invalid" <billcun@suddenlink.net> writes:
> I want to be sure what these two functions are for.
They are for reading/writing chunks of data to/from a stream.
> To copy for example 1 2048 size bytes block at a time?
You could use them for that purpose. They can also work with other
block sizes.
> I usually use fgetc and fputc.
It can be more efficient to work with whole blocks at once, rather than
one character at a time.
> But I would please like for someone if they would to show me an example
> of these functions.
Here's a sample using fread to read up to 1000 characters from a file:
char buf[1000];
FILE *fp;
fp = fopen("filename.txt", "r");
bytes_read = fread(buf, 1, sizeof(buf) - 1, fp);
buf[bytes_read] = 0;
fclose(fp);
Here's a sample using fwrite to write a fixed message to a file:
char *message = "Hello earthlings.";
FILE *fp;
fp = fopen("message.txt", "w");
bytes_written = fwrite(message, 1, strlen(message), fp);
fclose(fp);
The first argument to fread/fwrite is a pointer to the buffer being read
or written.
The second argument is the size of each element being read/written. In
these examples we're writing characters, so the size is 1. If we were
writing other objects, we would use the size of those objects.
The third argument is the number of elements to be read/written.
The fourth argument is the stream to which the elements are to be
read/written.
The return value is the number of elements actually read/written, which
may be less than the number you requested, in which case you'll have to
keep calling fread/fwrite until all the data gets processed.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [next] | [standalone]
| From | billcun@suddenlink.net |
|---|---|
| Date | 2012-06-20 09:03 -0700 |
| Message-ID | <94838e77-73a9-4ea1-92e2-2cf53d55b51b@j25g2000yqn.googlegroups.com> |
| In reply to | #22376 |
On Jun 18, 6:05 pm, John Gordon <gor...@panix.com> wrote:
> In <2a2da336-fa08-4bfa-95b4-47f99a126877@googlegroups.com> "bill...@nspam.invalid" <bill...@suddenlink.net> writes:
>
> > I want to be sure what these two functions are for.
>
> They are for reading/writing chunks of data to/from a stream.
>
> > To copy for example 1 2048 size bytes block at a time?
>
> You could use them for that purpose. They can also work with other
> block sizes.
>
> > I usually use fgetc and fputc.
>
> It can be more efficient to work with whole blocks at once, rather than
> one character at a time.
>
> > But I would please like for someone if they would to show me an example
> > of these functions.
>
> Here's a sample using fread to read up to 1000 characters from a file:
>
> char buf[1000];
> FILE *fp;
> fp = fopen("filename.txt", "r");
> bytes_read = fread(buf, 1, sizeof(buf) - 1, fp);
> buf[bytes_read] = 0;
> fclose(fp);
>
> Here's a sample using fwrite to write a fixed message to a file:
>
> char *message = "Hello earthlings.";
> FILE *fp;
> fp = fopen("message.txt", "w");
> bytes_written = fwrite(message, 1, strlen(message), fp);
> fclose(fp);
>
> The first argument to fread/fwrite is a pointer to the buffer being read
> or written.
>
> The second argument is the size of each element being read/written. In
> these examples we're writing characters, so the size is 1. If we were
> writing other objects, we would use the size of those objects.
>
> The third argument is the number of elements to be read/written.
>
> The fourth argument is the stream to which the elements are to be
> read/written.
>
> The return value is the number of elements actually read/written, which
> may be less than the number you requested, in which case you'll have to
> keep calling fread/fwrite until all the data gets processed.
>
Thank you very much John. I understand the strlen because we are
dealing with a string. But what the -1 in your code for?
B
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2012-06-20 16:28 +0000 |
| Message-ID | <jrsto8$abf$1@reader1.panix.com> |
| In reply to | #22441 |
In <94838e77-73a9-4ea1-92e2-2cf53d55b51b@j25g2000yqn.googlegroups.com> billcun@suddenlink.net writes:
> Thank you very much John. I understand the strlen because we are
> dealing with a string. But what the -1 in your code for?
I assume you're asking about this line:
bytes_read = fread(buf, 1, sizeof(buf) - 1, fp);
The -1 allows room for a terminating null byte at the end of buf, because
buf is intended to be used as a string.
If we didn't intend to use buf as a string, the -1 would not be needed.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [next] | [standalone]
| From | billcun@suddenlink.net |
|---|---|
| Date | 2012-06-20 09:53 -0700 |
| Message-ID | <6734b1b3-2eea-4b15-aca5-ce7bc995d1cc@p13g2000yqk.googlegroups.com> |
| In reply to | #22442 |
On Jun 20, 12:28 pm, John Gordon <gor...@panix.com> wrote: > I assume you're asking about this line: > > bytes_read = fread(buf, 1, sizeof(buf) - 1, fp); > > The -1 allows room for a terminating null byte at the end of buf, because > buf is intended to be used as a string. > > If we didn't intend to use buf as a string, the -1 would not be needed. Thanks for your explaination John. Yes that was what I was talking about. And your patience.
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.c
csiph-web