This function is used to write one character at a time to a file. The filename is entered as a parameter to the function.
filename − This is the name to which the character needs to be written to.
This function returns 0 if all characters were successfully written to the file. If the function fails, then it returns the number of characters that failed to write to the file.
/* Main program */ status = charout(Example.txt,E) status = charout(Example.txt,x) status = charout(Example.txt,a)
When we run the above program, the characters ‘E’, ‘X’ and ‘a’ will be added to the file Example.txt.