Deutsch   English   Français   Italiano  
<wrapper-20241001111737@ram.dialup.fu-berlin.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: alt.folklore.computers,comp.os.linux.misc
Subject: Re: The joy of FORTRAN
Date: 1 Oct 2024 10:24:56 GMT
Organization: Stefan Ram
Lines: 26
Expires: 1 Jul 2025 11:59:58 GMT
Message-ID: <wrapper-20241001111737@ram.dialup.fu-berlin.de>
References: <pan$96411$d204da43$cc34bb91$1fe98651@linux.rocks> <5mqdnZuGq4lgwm_7nZ2dnZfqnPSdnZ2d@earthlink.com> <vcub5c$36h63$1@dont-email.me> <36KdnVlGJu9VLW77nZ2dnZfqn_qdnZ2d@earthlink.com> <971448126.749088380.092448.peter_flass-yahoo.com@news.eternal-september.org> <vd5195$edas$1@dont-email.me> <59CJO.19674$MoU3.15170@fx36.iad> <vd6vto$r0so$1@dont-email.me> <iJEJO.198176$kxD8.81657@fx11.iad> <3hOdnWpQ649QMGr7nZ2dnZfqnPidnZ2d@earthlink.com> <vd8doi$15q07$1@dont-email.me> <vd8eg7$15v1j$2@dont-email.me> <cxicnVzg_cn_eGX7nZ2dnZfqnPadnZ2d@earthlink.com> <vdapbn$1kp35$5@dont-email.me> <lltpunF4fseU2@mid.individual.net> <1smdnSjX3YoxgWf7nZ2dnZfqn_idnZ2d@earthlink.com> <llv30aFa6uvU3@mid.individual.net> <vde4b8$268qv$22@dont-email.me> <1396870532.749421730.052473.peter_flass-yahoo.com@news.eternal-september.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de eqnJuS3BNYpjfbHXt6eqqgf7fqiJSaG6+bAlxGZF739IeB
Cancel-Lock: sha1:bdxaOSbmrOUmuSmQezUDIc+7eMY= sha256:iG9vztqp+9bCO++HmL+7fU7DoR4sIkdodUSnvGMt7wE=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
	Distribution through any means other than regular usenet
	channels is forbidden. It is forbidden to publish this
	article in the Web, to change URIs of this article into links,
        and to transfer the body without this notice, but quotations
        of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
	services to mirror the article in the web. But the article may
	be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Bytes: 3020

Peter Flass <peter_flass@yahoo.com> wrote or quoted:
>The Natural Philosopher <tnp@invalid.invalid> wrote:
>>printf("hello world"); That's bug proof. 
>Wait, what? Where’s your error checking? What if your printf fails?
>Actually that’s one of the things I like least about C. It leaves all error
>checking up to the programmer instead of having even a minimal handler for
>errors not otherwise caught.

  You could write a wrapper for printf, "myprintf",
  that will call printf and then do minimal error handling.

#include <stdio.h>
#include <stdarg.h>

int myprintf( char const * format, ... ) 
{ va_list args;
  va_start( args, format );
  int const result = vprintf( format, args );
  va_end( args );
    
  if( result < 0 )fprintf
  ( stderr, "Error: printf failed with return code %d\n", result );
    
  return result; }