/[projects]/misc/mysql_splitter/splitter.cpp
ViewVC logotype

Diff of /misc/mysql_splitter/splitter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1461 by torben, Thu May 12 15:32:44 2011 UTC revision 1464 by torben, Thu May 12 19:38:56 2011 UTC
# Line 1  Line 1 
1  #include <iostream>  #include <iostream>
2    #include <iomanip>
3  #include <sstream>  #include <sstream>
4  #include <string>  #include <string>
5  #include <vector>  #include <vector>
# Line 91  int main(int argc, char** argv) { Line 92  int main(int argc, char** argv) {
92          }          }
93    
94    
95          FILE* in = fopen( inputfile.c_str(), "r" );          FILE* in = fopen64( inputfile.c_str(), "r" );
96          FILE* out = NULL;          FILE* out = NULL;
97          //ifstream in( inputfile.c_str() );          //ifstream in( inputfile.c_str() );
98          //ofstream out;          //ofstream out;
# Line 100  int main(int argc, char** argv) { Line 101  int main(int argc, char** argv) {
101    
102          if ( in == NULL ) {          if ( in == NULL ) {
103                  cout << "Could not open " << argv[1] << endl;                  cout << "Could not open " << argv[1] << endl;
104                    perror("");
105                  return 2;                  return 2;
106          }          }
107    
# Line 135  int main(int argc, char** argv) { Line 137  int main(int argc, char** argv) {
137                          bool did_exist = boost::filesystem::exists(filename);                          bool did_exist = boost::filesystem::exists(filename);
138    
139                          //out.open( filename.c_str(), ios::app );                          //out.open( filename.c_str(), ios::app );
140                          out  = fopen(filename.c_str(), "a");                          out  = fopen64(filename.c_str(), "a");
141    
142    
143    
# Line 154  int main(int argc, char** argv) { Line 156  int main(int argc, char** argv) {
156    
157                  if (out != NULL ) {                  if (out != NULL ) {
158                          fputs(linebuf, out);                          fputs(linebuf, out);
159                          fputs("\n", out);                          //fputs("\n", out);
160                          //out << linebuf << endl;                          //out << linebuf << endl;
161                  } else {                  } else {
162                          header << linebuf << endl; //collect preamble for later use                          header << linebuf; //collect preamble for later use
163                  }                  }
164    
165          }          }
# Line 171  int main(int argc, char** argv) { Line 173  int main(int argc, char** argv) {
173    
174      time_t end = time(NULL);      time_t end = time(NULL);
175    
176      cout << "Elapsed " << (end-start) << " seconds" << endl;  
177            time_t elapsed = end-start;
178            cout << setfill('0') << "Elapsed time " << elapsed/60 << ":" << setw(2) << elapsed%60 << endl;
179    
180          fclose(in);          fclose(in);
181  }  }

Legend:
Removed from v.1461  
changed lines
  Added in v.1464

  ViewVC Help
Powered by ViewVC 1.1.20