0

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.

Edited by robinotje: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by robinotje
1

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

Edited by Ancient Dragon: n/a

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.