Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #43617

Re: errno

From Richard <rgrdev_@gmail.com>
Newsgroups comp.lang.c
Subject Re: errno
Date 2014-04-26 23:56 +0200
Organization http://www.ieee.org/
Message-ID <87ppk3n4b1.fsf@gmail.com> (permalink)
References <ljh687$b06$1@dont-email.me>

Show all headers | View raw


"Bill Cunningham" <nospam@nspam.invalid> writes:

>     My little utility doesn't print an errno value like it should. I have 
> tried to fix it but have failed. I've never really used errno.h but always 
> perror() so what am I doing wrong here.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <string.h>
>
> int main(int argc, char *argv[])
> {
>     long int a;
>     errno = 0;
>     if ((a = strtol(argv[1], NULL, 16)) == -1)
>         printf("%s\n", strerror(errno));
>     printf("%d\n", a);
>     return 0;
> }
>

0/10

Up yer game Bill. Even the regs who are chomping at the bit to show off
aren't biting anymore.

-- 
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 16:51 -0400
  Re: errno Eric Wolf <eric@boese-wolf.eu> - 2014-04-26 23:11 +0200
    Re: errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 17:17 -0400
      Re: errno Ike Naar <ike@iceland.freeshell.org> - 2014-04-26 22:35 +0000
        Re: errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 19:35 -0400
  Re: errno Richard <rgrdev_@gmail.com> - 2014-04-26 23:56 +0200
  Re: errno Barry Schwarz <schwarzb@dqel.com> - 2014-04-26 17:15 -0700
    Re: errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 20:23 -0400
      Re: errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 20:27 -0400
    Re: errno "Bill Cunningham" <nospam@nspam.invalid> - 2014-04-26 20:42 -0400

csiph-web