User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed


Table of Contents


    int remove(const char *filename);

Removes specified file. Returns non-zero on failure.

Example Source

 * remove example code
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
#define FILENAME "test_tmp.txt"
int main ( void )
FILE *tmpfile;
char string[20];
tmpfile = fopen(FILENAME, "w");
if (tmpfile == 0 ) {
perror("cannot open file");
 fprintf (tmpfile, "temporary file for c remove example\n");
 remove (FILENAME); /* you can also use remove("test_tmp.txt"); */
 return 0; 


  file will be created
  write text into file "temporary file for c remove example"
  close the file
  file will be deletet

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdio.h/remove.txt · Last modified: 2013/01/22 22:02 (external edit)

Impressum Datenschutz