Simon Gust
Member
Hello,
I have run into a problem concerning file loading using
get_save_filename and get_open_filename.
I want to save a buffer using the file type .map
but it doesn't really work. I get the error
using a .txt file type to save, but I get the same results.
buffer saving
buffer loading
I have run into a problem concerning file loading using
get_save_filename and get_open_filename.
I want to save a buffer using the file type .map
but it doesn't really work. I get the error
If I use buffer load ext to load the buffer I getCannot load buffer file
which is very confusing for me. I know these functions aren't sandboxed and I have tried
using a .txt file type to save, but I get the same results.
buffer saving
Code:
// get file name
fileName = get_save_filename("maps|*.map", "");
// create buffer
fileBuffer = buffer_create(12, buffer_fixed, 4);
buffer_write(fileBuffer, buffer_u32, numLayer);
buffer_write(fileBuffer, buffer_u32, layerWidth);
buffer_write(fileBuffer, buffer_u32, layerHeight);
// save data
buffer_save(fileBuffer, fileName);
Code:
// get file name
fileName = get_open_filename("maps|*.map", "");
// load data
fileBuffer = buffer_load(fileName);
/*
or
fileBuffer = buffer_create(12, buffer_fixed, 4);
buffer_load_ext(fileBuffer, fileName, 0);
*/
numLayer = buffer_read(fileBuffer, buffer_u32);
layerWidth = buffer_read(fileBuffer, buffer_u32);
layerHeight = buffer_read(fileBuffer, buffer_u32);
// free buffer
buffer_delete(fileBuffer);