I posted a similar code earlier, but I think this is a different issue now. I just can't figure out why my run code won't go past "infile open". ("-e" prints out, "-d" doesn't) I'm trying to open my file, use a command line option to determine if I will print out a certain multiple of characters.
For example, a.out -d 2 < sample.txt will print out every second letter.
int main (int argc, char *argv[])
{
   ifstream infile; 
   if (infile.good())
      printf("infile open \n");
   int c;    
   int number = 0;
   int count = 0; 
   string str1 = argv[1];
   string str2 = "-d";
   string str3 = "-e";
   if (str1.compare(str2) == 0)
   { 
      printf("entered -d\n");
      c = infile.get();       
         while(!infile.eof()) {
             number = atoi(argv[2]);  
              if (count == number)
            {
              cout.put(c);
                      count = 0;
                }
                  else
                      count++;
             c = infile.get();         
}//end while 
}//end if
           if (str1.compare(str3) == 0)       
                printf("entered -e\n");
}//end main
 
     
    