Determine dst and chars_written based on flags