char *root is the name of the directory where the file is to be written.
char *name is the name of the file is to be written.
char *str is the string to write.