Next Previous Contents

3.159 remove

Function

Delete a file.

Header

stdio.h

Declaration

int __fastcall__ remove (const char* name);

Description

remove deletes the file with the given name. On success, zero is returned. On error, -1 is returned and errno is set to an error code describing the reason for the failure.

Limits

  • This function is not available on all cc65 targets (depends on the availability of file I/O).
  • The function is only available as fastcall function, so it may only be used in presence of a prototype.

Availability

ISO 9899

See also

rename, unlink

Example

#include <stdio.h>

#define FILENAME "helloworld"

if (remove (FILENAME) == 0) {
    printf ("We deleted %s successfully\n", FILENAME);
} else {
    printf ("There was a problem deleting %s\n", FILENAME);
}


Next Previous Contents