I have a program which creates a configuration directory inside of a directory called "a" and puts a file inside the configuration directory, which of course would be the configuration file which is necessary to run the program. Without it, the program won't run. I currently have the following code (I know that system calls are bad practice, no need to scold me on that):
This creates the a and test directories (test is the configuration directory), although no file is created called test.txt. When I do it like this, it works:
The problem is that I need it to make the file in the user's home directory; the user is probably not named jonny. I know that system calls are bad, but those are kind of a placeholder for a mkdir function I'm working on. Essentially, I just want to place a file in the user's home directory containing configuration info, although whenever I use ~ for the user's home directory, no file appears. I will not be able to make a customized program for every individual user for the path to their home directory; How can I get this to work?
Also, I am fairly sure C++ doesn't understand the '~' symbol to mean the home directory. The reason it works with the system() command is because it is run by the shell (which translates the '~' symbol).