Using close function twice loses the filename
Posted: September 13th, 2022, 9:42 pm
Hi CSPRO team,
I was dealing with a bug in a big application until I found the source of the problem. When we use the close funcion, the filename of the corresponding file is changed to null (empty), if you reopen the file, the original filename comes back, but if you close the file twice and if you try to open again the file, the original filename was lost. Just to show this situation please check the following lines:
setfile(TEST_DICT,"JUSTFORTEST.csdb",create);
errmsg("Original filename=%v",filename(TEST_DICT));
close(TEST_DICT);
errmsg("Empty filename because the file is closed=%v",filename(TEST_DICT));
open(TEST_DICT);
errmsg("Original filename returns after open=%v",filename(TEST_DICT));
close(TEST_DICT);
close(TEST_DICT);
open(TEST_DICT);
errmsg("Original filename is lost after two consecutive close=%v",filename(TEST_DICT));
I can not say it is a CSPRO bug, but it is a weird behaviour.
Kind regards,
Harry
I was dealing with a bug in a big application until I found the source of the problem. When we use the close funcion, the filename of the corresponding file is changed to null (empty), if you reopen the file, the original filename comes back, but if you close the file twice and if you try to open again the file, the original filename was lost. Just to show this situation please check the following lines:
setfile(TEST_DICT,"JUSTFORTEST.csdb",create);
errmsg("Original filename=%v",filename(TEST_DICT));
close(TEST_DICT);
errmsg("Empty filename because the file is closed=%v",filename(TEST_DICT));
open(TEST_DICT);
errmsg("Original filename returns after open=%v",filename(TEST_DICT));
close(TEST_DICT);
close(TEST_DICT);
open(TEST_DICT);
errmsg("Original filename is lost after two consecutive close=%v",filename(TEST_DICT));
I can not say it is a CSPRO bug, but it is a weird behaviour.
Kind regards,
Harry