----------------------------------------------------------------------------- Close the File. Returns the currentStatus -----------------------------------------------------------------------------
| 458 | // Returns the currentStatus |
| 459 | //----------------------------------------------------------------------------- |
| 460 | File::Status File::close() |
| 461 | { |
| 462 | if (handle != NULL) |
| 463 | { |
| 464 | // check if it's already closed... |
| 465 | if (Closed == currentStatus) |
| 466 | return currentStatus; |
| 467 | |
| 468 | // it's not, so close it... |
| 469 | if (handle != NULL) |
| 470 | { |
| 471 | if (fclose((FILE*)handle) != 0) |
| 472 | return setStatus(); |
| 473 | } |
| 474 | handle = NULL; |
| 475 | return currentStatus = Closed; |
| 476 | } |
| 477 | |
| 478 | // check if it's already closed... |
| 479 | if (Closed == currentStatus) |
| 480 | return currentStatus; |
| 481 | |
| 482 | // it's not, so close it... |
| 483 | if (buffer != NULL) |
| 484 | { |
| 485 | delete[] buffer; |
| 486 | buffer = NULL; |
| 487 | size = 0; |
| 488 | filePointer = 0; |
| 489 | } |
| 490 | |
| 491 | return currentStatus = Closed; |
| 492 | } |
| 493 | |
| 494 | //----------------------------------------------------------------------------- |
| 495 | // Self-explanatory. |
no outgoing calls
no test coverage detected