...
Wiki Markup |
---|
The function {{fdopen()}} \[[Open Group 04|AA. C References#Open Group 05]\] can be used in conjunction towith {{open()}} to to determine if ana existing file has beenis opened, or a new file has been created, and then associate a stream with athe file descriptor. |
Code Block |
---|
... FILE *fp; int fd; fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, new_file_mode); if (fd == -1) { /* Handle Error */ } fp = fdopen(fd,"w"); if (fp == NULL) { /* Handle Error */ } ... |
...