C
crisgoogle
I think so. (Linking up phrases and something and something and
something...)
Hookin' up clauses and phrases and words ...
(IIRC -- it's been 30 years or so -- but probably YTIYF))
=)
I think so. (Linking up phrases and something and something and
something...)
I don't believe I've ever posted any question like this before
concerning memory reallocation.
osmium said:For the umpteenth time.
I suggest you try something simpler that you might actually get to
work. Write a program that tries to read 20 char from a file that may
or may not exist.
argument.
So?
You can create a file to test your program by using a text editor.
Tim Rentsch said:You might want to try posting this again 11 months from now.
Barry Schwarz said:One of your more pedestrian trolling efforts Bill!
Original post:
Title completely unrelated to the code
Bad grammar
Comparing the number of command line arguments to the length
of a value
Comparing a pointer to a negative int
Non-portable return value from main
Trying to read 20 int into an array of 20 char
Assigning a potentially negative number to a size_t
Using = instead of == in an if
Asking a question about a function call that does not appear
in the post
Discussing the third parameter of a function that has only one
Discussing non-existent casts
Follow up:
Discussing input operations on size-t objects that do not
exist.
Here:
Finally reaching the inevitable conclusion of all your
threads, random guessing on how to solve an unspecified problem.
I think the 2 out of 10 rating given else thread was too generous. I
suggest you change your goal from error density to subtlety.
Bill Cunningham said:Why?
The file's name is specified by a command line
What's this post all about? What's it's title? I could've picked picked
a better title true. Which do you think would've made a better title?
1) stream question or
2) memory allocation question ?
Ian said:"Bill" first asked about malloc in 2003 (as seen from google).
Go figure.
malloc is the only memory allocation I know about other than arrays.
realloc must come into play somewhere.
Ian said:"Bill" first asked about malloc in 2003 (as seen from google).
Go figure.
[...]osmium said:Your post made clear that you were trying to skip the fundamentals
and go right to the meat of the thing; for this week your target was
"malloc". My suggestion was for a more ordered approach in which you
might actually learn something and get a program you had written to
work. But clearly you don't like that approach.
realloc() could, for example, be used to implement a dynamic "array"
that grows in size as elements are added and shrinks as elements are
removed.
Bill Cunningham said:[...]osmium said:Your post made clear that you were trying to skip the fundamentals
and go right to the meat of the thing; for this week your target was
"malloc". My suggestion was for a more ordered approach in which you
might actually learn something and get a program you had written to
work. But clearly you don't like that approach.
How much more to "the meat of the thing" is malloc? I'm not sure that
I'm understanding you. What do you mean by a "more ordered approach" ? The
program that was written did not included malloc. And I noticed later it
was full of bugs as posted. I must admit I need to start testing code and
examining it more closely before posting. fread as was in the program is
designed to take a set number of data.
Hence my point. I am in no position to write code that expands and
ontracts memory storage on the fly. That was what my inquiry was
concerning. Using the FILE* and streams as an example.
Bill Cunningham said:Ian Collins wrote:
http://groups.google.com/group/comp.lang.c/browse_thread/thread/8505637713d6e1eb/885a55feeb4d25d0
Nope after viewing the link above, I think I can still say I
don'tbelieve I've ever posted anything about memory
allocation. Encrypting andrandom strings maybe. I've never used
malloc before in code but it is verypopular.B
Angel wrote:
[snip]
realloc() could, for example, be used to implement a dynamic "array"
that grows in size as elements are added and shrinks as elements are
removed.
Exactly what I was looking for. Using the example of streams and the
FILE* struct. I don't think fread should even be used for this come to think
of it. fgetc might be a better way. But I have no idea where to even begin
with designing a function to set aside storage and allow it to grow and
shrink dynamically.
osmium said:Memory that expands or contracts is more complicated than a fixed
target of known maximum size.Your post tells me you can't even handle
that. Thus the simpler assignment I suggested. Your knowledge of
argc, for example is woefully wrong.. If you understand the basics
you should be able to do what I wrote in five minutes or less.
You might be better posting questions in 'comp.lang.c.moderated', it
is a mostly quiet group but one where questions get answered.
Default User said:Bill has supposedly been learning C for the better part of a decade. Over
the course of numerous threads during that time, his knowledge of the
language and specific parts of the language have waxed and waned. He will
use some function correctly in one program, then a month later use it with
the wrong inputs, or even claim to be unaware of it.
Many of us have come to the conclusion that it's a long-con troll. If it's
not, then his capacity for learning the language simply doesn't exist. He
demonstrates less capability than a first-sememster student at mid-terms.
Either way, a waste of time to respond.
If Bill really wants to learn programming, I suggest that C may be one
of the worst possible languages for him to use. Of the languages I'm
familiar with, Python might be a much better choice.
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.