CCCPaste

68c44b1aadd30

#include 
#include  //system commands
#include 
#include     //time
#include    //Strings for file names
#include  //sleep
#include     //math

using namespace std;
using namespace cv;

/** Function Headers */
int getframes(string inFile);


/**@function main */
	int main(int argc, char** argv) {
    string inFile = "";
    if (argc == 1){
		inFile = "aabb.gif";
		cout << "number of Farmes: "  << getframes(inFile)<< endl;
		}
    if( argc == 2 ) {
      inFile = argv[1];
      cout << getframes(inFile) << endl;
      } 
      if(argc >= 3){
      cout << "Usage: ./program InputFile \n \n This program converts gifs to png, that can be converted to gps srf files. \n";
      return 1;
    }
    
	return 0;
	}
	
int getframes(string inFile){
    system("rm /dev/shm/neu");       //stores system command output until I can put it in a varible.
	
	system(("identify -format \"%n\n\" " +inFile+ "| head -1 > /dev/shm/neu").c_str());	
	
  FILE* file = fopen ("/dev/shm/neu", "r");
  int i = 0;

  fscanf (file, "%d", &i);    
  while (!feof (file)){  
     fscanf (file, "%d", &i);  
    }
  //cout << "Number of frames in the file are: " << i <