#include <wchar.h>
|
int
wremove (const wchar_t *path); |
Upon successful completion, wremove return 0. Otherwise, -1 is returned and the global variable errno is set to indicate the error.
If
path
specifies a directory,
wremove (path);
is the equivalent of
wrmdir (path);
Otherwise, it is the equivalent of
wunlink (path);
/****************** this program shows deleting a file using wremove **************/ #include <stdio.h> int main() { wchar_t* name = L"C:\nput.txt"; FILE *fp = wfopen(name, L"w+"); if (fp == NULL) { printf ("fopen failed\n"); return -1; } fprintf(fp,"hello world"); fclose(fp); wremove(name); fp=wfopen(name,L"r"); if (fp == NULL) { printf ("file has been deleted already\n"); } else { printf("wremove failed\n"); return -1; } return 0; }
Output
file has been deleted already
© 2005-2007 Nokia |