--------------------------------------------------------------------* * File copy operations * *--------------------------------------------------------------------*/ ! * \brief fileCopy() * * \param[in] srcfile copy this file * \param[in] newfile to this file * \return 0 if OK, 1 on error */
| 1494 | * \return 0 if OK, 1 on error |
| 1495 | */ |
| 1496 | l_int32 |
| 1497 | fileCopy(const char *srcfile, |
| 1498 | const char *newfile) |
| 1499 | { |
| 1500 | l_int32 ret; |
| 1501 | size_t nbytes; |
| 1502 | l_uint8 *data; |
| 1503 | |
| 1504 | PROCNAME("fileCopy"); |
| 1505 | |
| 1506 | if (!srcfile) |
| 1507 | return ERROR_INT("srcfile not defined", procName, 1); |
| 1508 | if (!newfile) |
| 1509 | return ERROR_INT("newfile not defined", procName, 1); |
| 1510 | |
| 1511 | if ((data = l_binaryRead(srcfile, &nbytes)) == NULL) |
| 1512 | return ERROR_INT("data not returned", procName, 1); |
| 1513 | ret = l_binaryWrite(newfile, "w", data, nbytes); |
| 1514 | LEPT_FREE(data); |
| 1515 | return ret; |
| 1516 | } |
| 1517 | |
| 1518 | |
| 1519 | /*! |
no test coverage detected