pseudo code
assignfile();
rewrite(file);
blockwrite(myinteger,sizeof(myinteger));
blockwrite(myDouble,sizeof(myDouble));
blockwrite(length(myString), sizeof(integer));
blockwrite(myString[1],length(myString));
Keep on using blockwrite as needed then close the file.