looks like fwrite is the function to use