[Coin-discuss] calling exit() in CoinLpIO
Daniel Stoinski
Daniel.Stoinski at nagler-company.com
Thu Jul 13 06:40:15 EDT 2006
The same for printing to stdout/stderr, which is used at many various
places, not only in DEBUG-oriented code. It should be replaced by the
MessageHandler, isn't it?
Daniel
On Thu, 13 Jul 2006, Kish Shen wrote:
> Hi,
>
> I have been testing my code with reading and writing of LP/MPS files. To my
> surprise, when I tried to read an non-existing LP file (actually it was
> missing the .lp extension), my program exited, even though it was inside a
> try{...} designed to catch any problems with the reading of the file.
>
> It seems that for routines that read/write LP/MPS files in CoinLpIO.cpp, they
> all call exit(1) when some error occur, e.g. for readLp():
>
> void
> CoinLpIO::readLp(const char *filename)
> {
> FILE *fp = fopen(filename, "r");
> if(!fp) {
> printf("### ERROR: CoinLpIO: Unable to open file %s for reading\n",
> filename);
> exit(1);
> }
>
> this seems rather drastic -- should it not throw a CoinError instead?
>
> Cheers,
>
> Kish Shen
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>
More information about the Coin-discuss
mailing list