void main() { Aggregator aggregator; RunTest1( aggregator ); RunTest2( aggregator ); RunTest3( aggregator ); ProcessCSV( aggregator ); }
int _tmain(int argc, _TCHAR* argv[]) { int iCSVCount = CountCSVs(); int iCurrCompiledLine = 0; int iTotalWPCount = iCSVCount+1; char compiledFilename[256]; int iCompiledFileCount = 0; int iCompiledLineCount = 0; if(!iCSVCount) { return 0; } sprintf(compiledFilename, "PeZBOT_WP_%d.csv", iCompiledFileCount); FILE *pCompiledFile = fopen(compiledFilename, "w"); //print number of csvs on first line fprintf(pCompiledFile, "%d,%d,0,0\n",iCurrCompiledLine++, iCSVCount); //build the header for the compiled csv BuildCompiledCSVHeader(pCompiledFile, &iCurrCompiledLine, &iTotalWPCount); struct _finddata_t csv_file; long hFile; // Find first .csv file in current directory if((hFile = _findfirst("*.csv", &csv_file)) == -1L) { printf("No *.csv files in current directory!\n"); } else { //Find the .csv files do { /* printf( ( csv_file.attrib & _A_RDONLY ) ? " Y " : " N " ); printf( ( csv_file.attrib & _A_SYSTEM ) ? " Y " : " N " ); printf( ( csv_file.attrib & _A_HIDDEN ) ? " Y " : " N " ); printf( ( csv_file.attrib & _A_ARCH ) ? " Y " : " N " ); printf( " %-12s %.24s %9ld\n", csv_file.name, ctime( &( csv_file.time_write ) ), csv_file.size ); */ if(!strstr(csv_file.name, "PeZBOT_WP_")) { if(iCompiledLineCount > 800) { iCompiledFileCount++; sprintf(compiledFilename, "PeZBOT_WP_%d.csv", iCompiledFileCount); fclose(pCompiledFile); pCompiledFile = fopen(compiledFilename, "w"); iCompiledLineCount = 0; } int iOldCurrCompiledLine = iCurrCompiledLine; ProcessCSV(pCompiledFile, csv_file, &iCurrCompiledLine); iCompiledLineCount += iCurrCompiledLine-iOldCurrCompiledLine; } } while(_findnext(hFile, &csv_file) == 0); _findclose(hFile); } fclose(pCompiledFile); return 0; }