Bill Reid wrote, On 20/03/08 01:57:
Oh God, what did I say about this NEVER ends...
Flash Gordon said:
Bill Reid wrote, On 12/03/08 14:49:
Bill Reid wrote, On 12/03/08 01:54:
Bill Reid wrote:
Bill Reid wrote:
[...]
"Is it possible to write a totally 'portable'
function that will consume ALL the characters left in the standard
input
regardless of platform?"
Yes, barring I/O errors that disrupt the flow of control.
#include <stdio.h>
void eat_stdin(void) {
for (;;getchar());
}
Exactly, some code to that effect, I thought everybody knew this...so
why is it news to all the other posters to this thread but you and me?
If you know how to do the job correctly in one line then you have even
less excuse for posting a non-portable solution.
You trolls really need to coordinate your efforts better...you've got
about three different and mutually exclusive threads of insane troll
logic going here...the above is the "joke troll", and another troll is
now actually ENDORSING fflush(stdin)!!!
Your inability to understand the issues people point out does not make
the logic insane. Your claiming that everyone that disagrees with you is
a troll does not help your arguments.
Where have I displayed an "inability to understand the issues"?
Each time you have denied that they are real issues.
I have undeniably displayed GREAT understanding of the "issues".
To aver otherwise is a TROLL, period. To claim that somehow I
am destroying the budding career of a nascent programmer by
posting functional "C" code is also a TROLL, PERIOD.
Ah, but it is only functional on your specific implementation, not
functional in general. Another example of you demonstrating a failure to
understand the issues.
You can "disagree" with that, but you'd be wrong...
And an example of your arrogance.
You all address points at RANDOM for the apparent sole purpose
of TROLLING.
No, different people thing about and raise different issues. That is
human nature.
I KNOW they don't have valid "reasons". I've covered this TIME
and TIME again.
Thus showing again that you do not understand the issues.
Something that MIGHT happen on another system,
or somebody deliberately trying to terminate a program stupidly,
are NOT "REASONS" to insult a person and claim that innocent
newbies are being misled. In fact, the TROLLS here are the ones
that are confusing and misleading the "newbies"...
Not all newbies are developing for the same platform as you. We have
seen people doing courses using Linux (where your code does not work)
and old versions of Turbo C (where you have probably not tested your
solution).
if(yn_input[string_size-1]!='\n') {
fflush(stdin);
goto ReTry;
}
Which is an effective work-alike to:
if(yn_input[string_size-1]!='\n') {
while(getchar()!='\n') ;
goto ReTry;
}
Will that work, or is it too "platform-specific"?
Well, the second case definitely won't flush everything from the input
buffers for standard input on some systems (the buffers, which include
OS buffers, could have more than one line in it on some systems under
some conditions), but it is more likely to meet the real requirements
rather than the stated objective of flushing the buffer.
Well, semantics again, a real problem that I'm willing to let slide,
I wasn't talking about flushing a "buffer", just getting rid of any
unconsumed
characters input by the user.
The buffers I mentioned are where that input is stored. So substitute
"unconsumed characters input by the user" for "buffers" and it still
applies.
OK, then I'll just use fflush(stdin) because that has a shot of
working to YOUR specification on MY system, your anal-retentive
highness.
It was *your* stated requirement, not mine.
Got a problem with THAT? Oh yeah, I forgot...you're
a TROLL, so of course you've got a problem with that, THE ONE
THING ABOUT TROLLS IS YOU CAN NEVER WIN, AND I
CAN'T WIN CAN I?!!?!!
I have no problem with you using anything you want in your own
unpublished code. If you publish code here using fflush(stdin) with it
marked as non-portable and what you expect it to do I also am unlikely
to comment on it.
Been over this time and time again, but I will admit that because
of certain college training and some of my actual money-making work
I have a greatly more educated approach as to what constitutes a "problem"
that will occur frequently enough to worry about...
Yet you show a lack of knowledge about the problems of real world
computing beyond your own system.
maybe if you went
back to school and got an actual education, at least you wouldn't have
all this free time to TROLL the Internet...
I have time to use Usenet because I am have demonstrated to my bosses
that I am knowledgeable, a fast learner, and able to do the jobs well
enough and fast enough.
YAY ME!!! Now my only question is:
WHY DOES THAT BUG YOU SO FRIGGIN' MUCH??!!!?!!
Seriously, what's your problem?
You posting non-portable code for others to use and insisting that is
not clearly marked as such for the use of people who will not have the
experience to recognise it as such.
That's not what I said, the code to eat all the characters to a newline
took me about as long to type it, maybe a three seconds, and I would
definitely consider anybody who took five minutes to be a drolling retard
that probably WOULD type CNTRL-z when prompted to press 'y' or
Well, up above you said it took you two hours the first time. Where as
it took me less than 5 minutes (I don't bother keeping track of how long
simple jobs take so I don't know how much less).
'n'...but I've already admitted you guys aren't SMART ENOUGH to
use my brilliant software...
Ah, so people well paid for there experience knowledge and skills are
not smart enough.
Tell the truth, you've never written a functioning line of code in your
worthless life.
That would explain why there are aircraft flying around with a lot of my
code in it, why my code has helped win large bids (including against
companies like Boeing), why my code is being used by large companies to
interface different systems etc.
I mean, how could you, boss walks in, gives you the
simplest assignment possible, months later you're still arguing about
buffers on Ukrainian abacii and the effect of the "I LOVE YOU" virus
on your program and on and on and on and on...
I don't, I just do it correctly because my boss expects it to be done
correctly. Fortunately my boss does not insist on non-portable and/or
incorrect solutions being used or on ignoring error conditions. In fact,
the putting in of traps for things people consider impossible has on a
number of occasions saved a lot of work and made us look good to the
customer, because those traps were triggered and the software either
handled it correctly or correctly reported what the problem was.
REAL programmers use two digits for year dates in 1996 and
are DONE with it (but waiting for the phone to ring to fix their crap
in 1999).
I kept being asked about whether my software was Y2K compliant, the
answer was yes. However, I did have to tell them that the OS on one of
the systems would have problems in 2028. So I would say that real
programmers in 1996 were designing and implementing their systems so
that they would correctly handle Y2K, which for some systems can be done
with a 2 digit year (well, some of my software would fail if you put it
in a time machine and took it back to some time in the 1800's, but that
is unlikely enough not to worry about). People who were doing what you
describe after being made aware of the problem were people who should
not be working in IT.
I NEVER ARGUED ABOUT IT, YOU LYING INSANE TROLL!!! I SAID
I PERSONALLY DIDN'T CARE FOR MY PURPOSES!!! I KNOW YOU'RE
STUPID, BUT YOU CAN'T BE THAT DUMB NOT TO BE ABLE TO TELL
THE DIFFERENCE!!!
When it was pointed out that fflush(stdin) is non-portable you claimed
that it works and the portability problem 'ONLY EXISTS ON THIS NEWSGROUP
AND NOT IN "REAL LIFE"...'. Making claims like that in a maner generally
considered to be the equivalent of arguing certainly seems like arguing
to me.
You still fail to understand that posting code here in answer to a
question is *not* posting code for your limited purposes. At least, not
unless your purpose is to provide bad advice.
You actually stated:
| For the "console" application, the code performs all possible error
| checking for fat-fingered idiotic input, and keeps prompting the user
| until it gets either 'y' or 'n', which it then returns to the calling
| function
This is clearly incorrect since you did not check for EOF which *can* be
generated in various ways.
They could have just pointed them out and be done with it when I
said I didn't care about that stuff, since NOTHING that ANY of you
TROLLS have brought up actually constitutes any kind of a REAL
"problem" with the code.
Only for your very limited usage. However for your limited usage it does
not have to be posted here.
YES, YOU INSANE TROLL, EXACTLY, FORCING YOUR INSANO
UNACHEIVABLE "REQUIREMENTS" ON ME IN AN INSULTING AND
MISLEADING FASHION IS A TROLL, PURE AND SIMPLE!!! I GLAD
YOU'RE LEARNING!!!
Well, as you don't want to address the requirements of anyone else why
post an answer? After all, to sensibly help someone with their code it
is *their* requirements not yours that matter.
SURE IT SHOULD, YOU CREEP!!!
So are saying there aren't such things as insane trolls on Usenet?
No, you are here. You are also failing to address the point above that
failure *do* happen in real life on stdin.
I say they exist with great regularity in this group RIGHT HERE IN
THIS THREAD!!! I have simple and objective tests for trolling behavior,
and applied them to this "real life" situation, sorry...
No, what you are doing is applying arrogance and trolling behaviour.
Possibly you are doing this to try and hide the fact that your program
was erroneous (the OP did not state the platform, so the only correct
answer would be one that was not platform dependant in undocumented ways).
JUST LIKE INSANE TROLLS!!!
I'm OK with my much simpler version; standard input EOF just doesn't
occur that much in MY "real life", but if it starts to crop up, I'll be the
first
to make that major change...
You still don't know if it occurs in the OPs real life. Some people do
learn programming on remote systems. Some people test interactive code
by piping in files to stdin (it makes it easy to replicate the test).
The OP could be tripped up by either quite easily. Some instructors also
read the code to see if it has been properly written, and the OP could
fall foul of that as well. So your code was certainly not suitable for
the OP to use.
THAT'S NOT WHAT I SAID!!!
No, a problem was pointed out and you claimed it was trolling, just as
you seem to claim every problem pointed out was a troll.
Great troll though, because for a second you kinda fished me in that
you understood what trolling behavior was...but I shoulda known better...
Oh, now it's "messy"...what's next, you gonna call it "icky"?
It would be appropriate. So would a number of other terms.
I'm sorry I called you "anal-retentive" because that is an insult
to stool-retainers everywhere...
So now you are insulting people for pointing out bad style in your code,
style likely to get points knocked off if it is handed in as homework.
Sure it does troll. Sure it does...
Yes, for a start instructors knock off marks for bad coding style. Then
there are the reviews at work that would reject it. Then there is the
maintenance programmer who has to try and decipher needlessly complex code.
Well, troll, you'd best be policing all the "messy" code posted
here with those "problem" gotos...I expect to see a lengthy post
every time you see a goto here explaining exactly why they
are so "messy" and cause "problems"...
Now you are putting words in my mouth as well. I stated that it was the
use of goto to implement a retry use, not the use of goto in all situations.
For my purposes, that's not a drawback, that's a feature...
Ah, so you want code that hangs instead of doing anything useful. Or,
more likely, you failed to see the deliberate problem in the code and
are trying to pretend that you did.
Oh, a little from column "A", a little from column "B"...
Well, at least we have an admission you are trolling.
How about the fat guy in "Jurassic Park"?
Now actually address the point rather than making obviously stupid
remarks. Unless you really are so stupid you think that Jurassic Park
was a documentary.
So programmers don't like doughnuts? Hell, I myself like chocolate
icing and the granulated sugar ones (but rarely eat them to try to avoid
looking like the fat guy in "Jurassic Park"), what's the big deal? Man
you take offense easily...
You being needlessly insulting probably in an attempt to draw attention
away from the glaring problems in code you posted.
I think you have demonstrated clearly to any newbie who stumbles across
this thread that you don't understand the issues, don't know how to
write code that would be acceptable on a programming course or in most
companies, and can't take any criticism of your work.
Thread-Plonk