deleting files

hello there
I want to delete files in c++

my code
this is only a function of my program...
it doesn't delete the txt file that i want..
any help is appreciated

headers
1
2
3
4
5
6
7
#include<iostream>
#include<string>
#include<fstream>
#include<conio.h>
#include<windows.h>
#include<stdio.h>
using namespace std;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
void DELACCOUNTS()
{
	system("cls");
	cout<<"Enter Bank Account Number to be deleted: ";
	cin>>card1.ID;
	card1.ID+=".txt";

	ifstream myfile8;
	myfile8.open(card1.ID.c_str());
	if (myfile8.is_open())
		{
			
			remove(card1.ID.c_str());
			cout<<"Account Succcessfully Deleted!";
			system("PAUSE");
			MENU3();
		}
	else
		{
		cout<<"No Such Account Exists!";
		system("PAUSE");
		DELACCOUNTS();
		}

}
Last edited on
nevermind, solved....
How?
closed account (Dy7SLyTq)
you probably have to use sys/ something
Topic archived. No new replies allowed.