#include <fcntl.h>
|
#include <wchar.h>
|
int
wcreat (const wchar_t *path, mode_t mode); |
wopen and wcreat return the new file descriptor, or -1 if an error occurred(in which case, errno is set appropriately).
The wcreat function is the same as:
wopen(path, O_CREAT | O_TRUNC | O_WRONLY, mode); Limitation :Creating a new file doesn’t alter the time stamp of parent directory, created entry has only two time stamps access and modification timestamps. Creation time stamp of the file is not supported, here accesstime stamp is equal to modification time stamp.
/*************************************************************************************** * Detailed description : This test code demonstrates wcreat api usage, it creates a * in current working directory(if file exists then it is truncated. * * Preconditions : None ***************************************************************************************/ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <wchar.h> int main() { int fd = 0; fd = wcreat(L"Example.txt" , 0666); if(fd < 0 ) { printf("File creation failed \n"); return -1; } printf("Example.txt file created \n"); return 0; }
Output
Example.txt file created
© 2005-2007 Nokia |