Name

wremove - delete a wide character name and possibly the file it refers to path

Library

libc.lib

Synopsis

  #include <wchar.h>
  int wremove (const wchar_t *path);

Return values

Upon successful completion, wremove return 0. Otherwise, -1 is returned and the global variable errno is set to indicate the error.


Detailed description

The wremove function removes the file or directory specified by the wide character name referred by path.

If path specifies a directory, wremove (path);
is the equivalent of wrmdir (path);
Otherwise, it is the equivalent of wunlink (path);


Examples

/****************** this program shows deleting a file using wremove **************/
#include <stdio.h>
int main()
{
        wchar_t* name = L"C:\\input.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

         

Errors

The wremove function may fail and set errno for any of the errors specified for the routines wstat, wrmdir or wunlink.

See also

wrmdir, wunlink


Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top