If you have not previously used a file descriptor for your file, rather use fopen .
FILE* file = fopen("pathtoyourfile", "w+");
Note that fopen uses stand-library-calls, not system calls (open). Thus, you do not have many parameters (for example, specifying access control values).
See the man page .
source share