Hello everyone,

I'm new to C / C++, and just wanted to make a file which can delete an item. The code worked, but when I want to give a path, it doesn't work anymore. Any help?

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	remove ("c:\users\asus\new.docx");
                return 0; 
}

I'm running Vista, and use Microsoft visual studio 2008 express edition.

the \ character is a special character in c/c++ and has to be escaped, meaning you need two of them remove ("c:\\users\\asus\\new.docx");

Thank you very much! I tried it, and it works. I didn't thought of this before. :)

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.