How to append text to a text file in C++? And create a new text file if it does not already exist and append text to it if it does exist.

How to append text to a text file in C++? And create a new text file if it does not already exist and append text to it if it does exist.