removed unnecesary fflush
added code to xboard to return ersult to GUI, taken from Darky05s