|
From: Ioannis V. <no...@ho...> - 2002-11-23 22:18:36
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Luigi Santillo > Sent: Friday, November 22, 2002 4:35 PM > To: Dev-C++ Mailing List > Subject: Re: [Dev-C++] 2 more questions > > > On Thu, Nov 21, 2002 at 06:39:59PM +0000, Paul Ardeleanu wrote: > > Why are you all so keen in returning a value at the end of main? > > > > Paul > > Besides what Ioannis has already said, another good reason to > have a program return some value is to ... use the value! :) > > For instance, I remember that the (now, or soon to be, obsolete) > command.com shell allowed to write some script file like the > following > > rv_test.bat > ----------- > rem use return value of "foo" to choose a label > foo > > if errorlevel 2 goto label2 > if errorlevel 1 goto label1 > :else > echo program "foo" returned 0 (success) > goto end > > > :label1 > echo program "foo" returned 1 > goto end > > :label2 > echo program "foo" returned a value greater or equal to 2 > goto end > > :end > -------- Yep, errorlevels. I think Win & Linux have that too. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |