[Coin-discuss] calling exit() in CoinLpIO
Kish Shen
kish.shen at crosscoreop.com
Wed Jul 12 21:31:54 EDT 2006
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
More information about the Coin-discuss
mailing list