/*! * Saves a .3DS file from memory to disk. * * \param file A pointer to a Lib3dsFile structure containing the * the data that should be stored. * \param filename The filename of the .3DS file to store the data in. * * \return TRUE on success, FALSE otherwise. * * \see lib3ds_file_load * * \ingroup file */ Lib3dsBool lib3ds_file_save(Lib3dsFile *file, const char *filename) { FILE *f; Lib3dsIo *io; Lib3dsBool result; f = fopen(filename, "wb"); if (!f) { return(LIB3DS_FALSE); } io = lib3ds_io_new( f, fileio_error_func, fileio_seek_func, fileio_tell_func, fileio_read_func, fileio_write_func ); if (!io) { fclose(f); return LIB3DS_FALSE; } result = lib3ds_file_write(file, io); fclose(f); lib3ds_io_free(io); return(result); }
void CL_Lib3dsFile::save(CL_IODevice device) { CL_Lib3dsIo io(device); int result = lib3ds_file_write(file, io); if (!result) throw CL_Exception("Unable to save 3ds file"); }
/*! * Saves a .3DS file from memory to disk. * * \param file A pointer to a Lib3dsFile structure containing the * the data that should be stored. * \param filename The filename of the .3DS file to store the data in. * * \return TRUE on success, FALSE otherwise. * * \see lib3ds_file_load * * \ingroup file */ Lib3dsBool lib3ds_file_save(Lib3dsFile *file, const char *filename) { FILE *f; f=osgDB::fopen(filename, "wb"); if (!f) { return(LIB3DS_FALSE); } if (!lib3ds_file_write(file, f)) { fclose(f); return(LIB3DS_FALSE); } fclose(f); return(LIB3DS_TRUE); }
/*! * Saves a .3DS file from memory to disk. * * \param file A pointer to a Lib3dsFile structure containing the * the data that should be stored. * \param filename The filename of the .3DS file to store the data in. * * \return TRUE on success, FALSE otherwise. * * \see lib3ds_file_open */ int lib3ds_file_save(Lib3dsFile *file, const char *filename) { FILE *f; Lib3dsIo io; int result; f = fopen(filename, "wb"); if (!f) { return FALSE; } memset(&io, 0, sizeof(io)); io.self = f; io.seek_func = fileio_seek_func; io.tell_func = fileio_tell_func; io.read_func = fileio_read_func; io.write_func = fileio_write_func; io.log_func = NULL; result = lib3ds_file_write(file, &io); fclose(f); return result; }