/* --------------------------------------------------------------------------- * Write a Targa image to a file named <filename> from <src>. This is just a * wrapper around tga_write_to_FILE(). * * Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure. */ tga_result tga_write(const char *filename, const tga_image *src) { tga_result result; FILE *fp = fopen(filename, "wb"); if (fp == NULL) return TGAERR_FOPEN; result = tga_write_to_FILE(fp, src); fclose(fp); return result; }
/* --------------------------------------------------------------------------- * Write a Targa image to a file named <filename> from <src>. This is just a * wrapper around tga_write_to_FILE(). * * Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure. */ tga_result tga_write(const char *filename, const tga_image *src) { tga_result result; FILE *fp; if (0 != physx::shdfnd::fopen_s(&fp, filename, "wb")) return TGAERR_FOPEN; result = tga_write_to_FILE(fp, src); fclose(fp); return result; }
/* --------------------------------------------------------------------------- * Write a Targa image to a file named <filename> from <src>. This is just a * wrapper around tga_write_to_FILE(). * * Returns: TGA_NOERR on success, or a matching TGAERR_* code on failure. */ tga_result tga_write(const char *filename, const tga_image *src, tgaFileOperations* fops) { tga_result result; TGA_FP *fp = NULL; if (0 != TGA_FOPEN_S(fops, &fp, filename, "rb")) return TGAERR_FOPEN; result = tga_write_to_FILE(fp, src, fops); TGA_FCLOSE(fops, fp); return result; }