add flush() function in cdata.c