Re: question
- From: "Bill Cunningham" <nospam@xxxxxxxxxxxxx>
- Date: Wed, 24 Sep 2008 20:07:24 -0400
"Keith Thompson" <kst-u@xxxxxxx> wrote in message
news:lnabdx864e.fsf@xxxxxxxxxxxxxxxxxx
If argc is not equal to 5, you print an error message *and thenAh Keith good to hear from you. I have changed that if statement to include
continue with the rest of the program, using garbage input*.
strtod is capable of telling you about errors. Use that capability.
Don't ask us how; look it up.
atoi() is *not* capable of telling you about errors. Use strtol()
instead. And check for errors.
For every standard function you use, you must have a #include
directive for the corresponding header.
an exit(EXIT_FAILURE) call so the program exits and there's no seg fault.
I am just used to using atoi. So there's no error checking. I haven't
included that at all in this program I usually do that with streams and
such. It would be a good thing to start. I'll check out strtol.
Bill
.
- References:
- question
- From: Bill Cunningham
- Re: question
- From: Keith Thompson
- question
- Prev by Date: Re: Difference between C and advanced C
- Next by Date: Re: question
- Previous by thread: Re: question
- Next by thread: Re: question
- Index(es):
Relevant Pages
|