0

I want to ask this question: what can i do(code langage c) to remove a file when i create it with fopen. I want to use remove .

Remove file langage c

18th Feb 2020, 6:52 AM
Malick Diagne
Malick Diagne - avatar
1 Answer
+ 1
Something like this: //---- const char *file_name = "file.txt"; FILE *f = fopen(file_name, "w"); // work with file...... fclose(f); if(!remove(file_name)){ printf("file removed successfully\n"); }else{ printf("can't remove file\n"); perror("error: "); } //------
18th Feb 2020, 8:51 AM
andriy kan
andriy kan - avatar