How to Delete a File in C

How to Delete a File in C thumbnail
Bjarne Stroustrup, Creator of C++

C++ is considered a highly adaptable, middle-level programming language. It is used to develop and write software for computer applications, network servers and video game software. It is a vastly popular computer language, having developed through three phases since its creation in 1979 at the hands of renown Danish programmer Bjarne Stroustrup. Deleting a file in C++ is a simple matter of knowing the code and the format for deletion.

Instructions

    • 1

      Access your key menu.

    • 2

      Type the following code: #include<stdio.h>, then press "enter."

    • 3

      Type the following code: int main(), then press enter and add a { value.

    • 4

      Type the following code: if(remove("filetobedeleted.txt") == -1), where "filetobedeleted.txt" is the name and extension of the file you want deleted. Press "enter" and add a { value.

    • 5

      Type the following code: fprintf(stderr,"Remove failed"); -- press "enter" -- then type: exit(EXIT_FAILURE); press "enter" and add a } value.

    • 6

      Press "enter," then type the following code: exit(EXIT_SUCCESS); -- press "enter" -- then add a } value.

Related Searches:

References

Resources

  • Photo Credit Image from Wikimedia Commons

Comments

You May Also Like

Related Ads

Featured