[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


remove

Delete a file.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <stdio.h>
int remove(const char *filename);
Parameters:

Parameters for this facility are:

filename  
const char *  
The name of the file to be deleted  

Remarks:

The remove() function deletes the named file specified by filename.

Return:

remove() returns 0 if the file deletion is successful, and returns a nonzero value if it fails.

See Also:

"fopen"

"rename"

Example of remove() usage.:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	char filename[40];
	
	// get a filename from the user	
	printf("Enter the name of the file to delete.\n");
	gets(filename);

	// delete the file
	if (remove(filename) != 0) {
		printf("Can't remove %s.\n", filename);
		exit(1);
	}

	return 0;
}


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000