pointers

D

Default User

Seebs said:
One presumes that he can't read, at some fairly fundamental level.
Google "alexia" sometime and compare it to his posts.

All I know is that in 2008, Bill seemed to know how fread() worked just
fine, now he doesn't. Trolling. Regressing. Take your pick. Either way,
a complete waste of time replying.



Brian
 
N

Nick Keighley

man fread
----------

so this is the output from the
man command yes?
NAME
       fread, fwrite - binary stream input/output

SYNOPSIS
       #include <stdio.h>

       size_t fread(void *ptr, size_t size, size_t nmemb, FILE
*stream);

DESCRIPTION
       The function fread() reads nmemb elements of data, each size
bytes long, from the stream pointed to by stream, storing them at the
location given by ptr.

"Storing at the location given by ptr" ???? huh

in what way is this unclear? "location" means "memory location". What
else /could/ it mean?

Didn't remember that meant buffer.

what do you think "buffer" means?
Sorry my C book says void * buf not the
man page.

it /does/ I can see it!!!!!!!!!!!!! look
size_t fread(void *ptr, size_t size, size_t nmemb, FILE

WHAT IS THE TYPE OF ptr?
 
B

Ben Bacarisse

Nick Keighley said:
On 11 Feb, 19:53, "Bill Cunningham" <[email protected]> wrote:
so this is the output from the
man command yes?


it /does/ I can see it!!!!!!!!!!!!!

I can't.
look
size_t fread(void *ptr, size_t size, size_t nmemb, FILE

WHAT IS THE TYPE OF ptr?

It's void *, of course.

You and I both know that void *ptr and void *buf are the same. It
could even read fread(void *, size_t, size_t, FILE *); and we'd be
happy with that. We know that the name (and even if there is one) has
no effect on the meaning of the function prototype. But I suspect
that Bill does not.

When I reply to Bill, if I think that more that two consecutive !s are
called for, or if I feel drawn to the cap lock key, I stop writing and
kill the post. Just a thought.
 
B

Bill Cunningham

what do you think "buffer" means?

It could mean a location somewhere in a stream. For example *nix's dd
command. I use it a bit. It could mean point to a specific place in a
buffer. Like dd's seek option and like C's fseek. I guess you can't use that
parameter for that though.

clc is so topic specific that when a thead goes on and on there is not
much left to talk about except standard C functions. The same thing over and
over.

Bill
 
L

Lew Pitcher

what do you think "buffer" means?

It could mean a location somewhere in a stream. For example *nix's dd
command. I use it a bit. It could mean point to a specific place in a
buffer. Like dd's seek option and like C's fseek. I guess you can't use
that parameter for that though.

Bill, these /might/ be valid uses of the word "buffer", but I've never
encountered them. In fact, the dd(1) manual page doesn't use the
word "buffer" to indicate "a location in a stream"; heck, it doesn't use
the word "buffer" at all.
~ $ man dd | grep buffer
~ $


OTOH, FOLDOC's definition (http://foldoc.org/buffer) is almost exactly what
I learned over 30 years ago in my programming classes; something
that /every/ programmer I've ever talked to seems to agree with

1. An area of memory used for storing messages. Typically, a buffer will
have other attributes such as an input pointer (where new data will be
written into the buffer), and output pointer (where the next item will
be read from) and/or a count of the space used or free. Buffers are
used to decouple processes so that the reader and writer may operate at
different speeds or on different sized blocks of data.
2. An electronic device to provide compatibility between two signals, e.g.
changing voltage levels or current capability.
clc is so topic specific that when a thead goes on and on there is not
much left to talk about except standard C functions. The same thing over
and over.

Hmmmm..... Perhaps that's not a bad thing. In your case, you could learn a
lot from such a discussion.

But, I've seen a lot of discussions here on general programming practice, as
applied to programming in the C language. (I.e. sorting techniques,
recursion, string handling, tree management, etc.)

And, I've seen a lot of discussions on various "non-standard" elements, as
approached by C code that meets the C standard (i.e. handling "packed
decimal" values in C code, handling characterset translations in C code,
etc.)

As I said, you could learn a lot from reading /and trying to comprehend/
those discussions.
 
B

Bill Cunningham

[snip]
1. An area of memory used for storing messages. Typically, a buffer will
have other attributes such as an input pointer (where new data will be
written into the buffer), and output pointer (where the next item will
be read from) and/or a count of the space used or free. Buffers are
used to decouple processes so that the reader and writer may operate
at
different speeds or on different sized blocks of data.

That's exactly what confused me. With a parameter like void *ptr it
could mean a buffer or the "location" of an input or output ptr.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

struct and pointer question 33
Help with pointers 1
scanf internals 11
memset 24
Can't solve problems! please Help 0
error 28
pointers and pointing 24
A little rusty on pointers to pointers 1

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top