Re: this calls and checks strtol() correctly?
- From: rpbg123@xxxxxxxxx (Roland Pibinger)
- Date: Sun, 29 Jun 2008 11:39:50 GMT
On Sun, 29 Jun 2008 01:51:34 -0700 (PDT), badc0de4@xxxxxxxxx wrote:
You might want to add a test for *endptr != '\0'
If argv[2] contains "443foo", *endptr will be 'f' after the strtol()
call (and port will be 433)
In general (not for argv[2]) you may want to accept trailing
whitespace, e.g. because strtol accepts leading whitespace.
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
.
- Follow-Ups:
- Re: this calls and checks strtol() correctly?
- From: lovecreatesbea...@xxxxxxxxx
- Re: this calls and checks strtol() correctly?
- References:
- this calls and checks strtol() correctly?
- From: lovecreatesbea...@xxxxxxxxx
- Re: this calls and checks strtol() correctly?
- From: badc0de4
- this calls and checks strtol() correctly?
- Prev by Date: Re: are stdout and stderr different
- Next by Date: Re: adding colums to text
- Previous by thread: Re: this calls and checks strtol() correctly?
- Next by thread: Re: this calls and checks strtol() correctly?
- Index(es):
Relevant Pages
|