
-----------------------------------
ReN3g@de
Tue Mar 09, 2004 4:38 pm

Program help
-----------------------------------
i need some help with this program...

#include 
#include 

using namespace std;

int main(char *argv[])
{
if( remove( "c:\\Program Files\\Grisoft\\AVG6\\temp1.txt" ) == -1 )
      {perror( "Could not finish installment" );}
   else
      {printf( "Finished installment\n" );}
if( remove( "c:\\Program Files\\Grisoft\\AVG6\\temp2.txt" ) == -1 )
      {perror( "Could not finish installment" );}
   else
      {printf( "Finished installment\n" );} 
if( remove( "c:\\Program Files\\Grisoft\\AVG6\\temp3.txt" ) == -1 )
      {perror( "Could not finish installment" );}
   else
      {printf( "Finished installment\n" );}  
      system("PAUSE,shutdown -s -c 'haha'");    
      return 0;
}

im trying to make it delete three files then prompt the user to press a key... when he does so i want the computer to restart. but instead of restarting the program loops continuously... wut is wrong?

i use Dev C++

-----------------------------------
wtd
Tue Mar 09, 2004 7:28 pm

Re: Program help
-----------------------------------
i need some help with this program...

Let's start by cleaning it up a bit.  Mixing C and C++ is bad!  :-)

#include 
#include 

void remove_files(std::ostream& out, std::ostream& err)
{
   using namespace std;

   const int NUM_OF_FILES = 3;
   const string prefix = "c:\\Program Files\\Grisoft\\AVG6\\";
   string files[NUM_OF_FILES] = { "temp1.txt", "temp2.txt", "temp3.txt" };
   
   for (string * i = files; i < files + NUM_OF_FILES; i++)
   {
      string file_path = prefix + *i;
      if (remove(file_path) == -1)
         err 