loadsave.c: add Open_file_write/Open_file_read() functions

This commit is contained in:
Thomas Bernard 2018-02-16 10:03:10 +01:00
parent bbdee15990
commit 3ed5dc5786
2 changed files with 26 additions and 0 deletions

View File

@ -1749,3 +1749,23 @@ void Delete_safety_backups(void)
#endif
}
/// For use by Save_XXX() functions
FILE * Open_file_write(T_IO_Context *context)
{
char filename[MAX_PATH_CHARACTERS]; // filename with full path
Get_full_filename(filename, context->File_name, context->File_directory);
return fopen(filename, "wb");
}
/// For use by Load_XXX() and Test_XXX() functions
FILE * Open_file_read(T_IO_Context *context)
{
char filename[MAX_PATH_CHARACTERS]; // filename with full path
Get_full_filename(filename, context->File_name, context->File_directory);
return fopen(filename, "rb");
}

View File

@ -261,4 +261,10 @@ void Init_preview(short width,short height,long size,int format,enum PIXEL_RATIO
*/
void Write_one_byte(FILE *file, byte b);
/// For use by Save_XXX() functions
FILE * Open_file_write(T_IO_Context *context);
/// For use by Load_XXX() and Test_XXX() functions
FILE * Open_file_read(T_IO_Context *context);
#endif