I'm trying to create a function that will delete an already saved file. I was hoping std::remove() would do the trick but I don't know the syntax.

Will std::remove() work or should be trying something else...

Recommended Answers

All 3 Replies

Well if you include that function in a header inside namespace std

It will work.

Something like

namespace std
{
remove()
{

//Func goes here
}
}

And save that file, Dont forget to include the file when you try to use that function.

if remove.h is the file

#include <remove.h>
#include <iostream>

int main()
{
std::remove();
}

I guess it would work out if you do this.

If you plan to do any serious programming in C++ you absolutely must have a good reference.

How did you learn about the function to begin with if it wasn't with an example or reference?

I'm trying to create a function that will delete an already saved file. I was hoping std::remove() would do the trick but I don't know the syntax.

remove()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.