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.

Recommended Answers

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

Jump to Post

All 2 Replies

Re: Deleting a file 80 80

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");

Re: Deleting a file 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.