I want to create some files inside a directory in C with minimal code size.
For example, if my current directory is foo and I want to create foo/bar/file1.txt, I can not use fopen("bar/file1.txt", "w"); to create the bar/ directory and the file in a single line.
How can I achieve this without making a function that parses the path to the file and for each firectory uses mkdir if it does not exist? I am looking for a "touch" like behavior without using system() ?