As discover by The_Clyde, the filter in "file_dialog" doesnt work when you set your own filter parameter.
After a dig, Ive discovered it is a typo in the function called "filename(char* title,char* filter)".
The 'szFilter' definition isnt declared STATIC, so then this function terminates and returns to file_dialog, the
char array your filter is in gets freed. This wont happen if it is STATIC.
...
if (filter) {
static char szFilter[256]; //needs to be made STATIC
ZeroMemory(szFilter,256);
...