if don't put close() the above are running cool. prob_type can be LIN_KERN or LP. it is strange but it really works causing the execl() to choose right.Originally Posted by Salem
if don't put close() the above are running cool. prob_type can be LIN_KERN or LP. it is strange but it really works causing the execl() to choose right.Originally Posted by Salem
Probably because you're also using string constants in the call, like
If your compiler / linker folds identical string constants then there really is only one "LP" string in the whole file, and so comparing addresses works (though not for any good reason).Code:tsp_sol_call("/home/panos/vrp/concorde/TSP/concorde","concorde","LP", "/media/hda7/source_vrp/tsp_in.tsp");
You may as well have enum { isLP, isLinKern } as the type rather than strings.
Perhaps the program being run barfs without an open file descriptor, in which case
Which should be the equivalent ofCode:int fd = open("/dev/null", O_WR ); dup2( fd, 1 );
Code:/home/panos/vrp/concorde/TSP/concorde /media/hda7/source_vrp/tsp_in.tsp > /dev/null
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Use STDIN_FILENO, STDOUT_FILENO and STDERR_FILENO instead of literal 0, 1 and 2. You never know what weird system you'll want to port to.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law