Hi. Here is a simple beginners program. It uses "if_else" and returns no information. After execution, it deletes files within the same directory as the exe. Enjoy.
Simple Delete File
/* By lil_bit 2012: Free Open Source Code for all*/
/* remove example: This deletes file(s) from location the .exe is located.*/
/* Also notice only two headers with only one antiquated.*/
/* Please use care when using code*/
/* Namesta*/
#include <iostream>
#include <stdio.h>
int main ()
{
if( remove( "testd1.txt" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
if( remove( "testd2.txt" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
if( remove( "testd3.txt" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
return 0;
}
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
lil_bit 0 Newbie Poster
ravenous 266 Posting Pro in Training
lil_bit 0 Newbie Poster
triumphost 120 Posting Whiz
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
lil_bit 0 Newbie Poster
lil_bit 0 Newbie Poster
lil_bit 0 Newbie Poster
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
lil_bit 0 Newbie Poster
mrnutty 761 Senior Poster
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.