Gentlemen, (I'm assuming your both male)
thank again for the quick responses.
arkM, yes, I would like to see more. I have included
my C++ program below that takes 15 hours to run.
A collegue a work wrote a C progam using the same
input file and it ran in 45 minutes.
Big difference when using file IO in memory.
Question: if you don't know the size of your input file,
how can you get the size of it and then use that
value as your array size? Here is the dog C++
program... try not to laugh to much....
// testMF2.cpp : Defines the entry point for the console application.
//
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
#include <fstream.h>
#include <string.h>
int main()
{
ifstream OpenFile;
OpenFile.open("DD:VEHCNT"

;
ifstream OpenFil2;
OpenFil2.open("DD:CENSUS"

;
ofstream OpenFil3;
OpenFil3.open("DD:OVEHCNT",ios:

ut);
cout << "FILE OPEN STATS" << endl;
if (!OpenFile)
{
cout << "Unable to open INPUT FILE 1\n";
return 1;
}
else
{
cout << "INPUT FILE 2 opened" << endl;
}
if (!OpenFil2)
{
cout << "Unable to open the INPUT FILE 2\n";
return 1;
}
else
{
cout << "INPUT FILE 2 opened" << endl;
}
if (!OpenFil3)
{
cout << "Unable to open the OUT FILE 1\n";
return 1;
}
else
{
cout << "OUTPUT FILE 1 opened" << endl;
}
char arr[27];
char arr2[5];
char polkID[11];
char geoCode[7];
char unitCnt[10];
char censusYr[5];
cout << "this is a marker after array of 27" << endl;
char char_delim;
long x = 0;
long counter = 0;
long counter2 = 0;
int size = 0;
while (!OpenFile.eof())
{
OpenFile.getline(arr,27,char_delim='\n');
counter = counter + 1;
if (OpenFile.eof())
{
memset(arr2,0,0);
memset(censusYr,0,sizeof(censusYr));
OpenFile.close();
OpenFil2.close();
OpenFil3.close();
cout << "what is the number of records:" << counter << endl;
cout << "what is the number of record2:" << counter2 << endl;
break;
}
if (counter2 < 1)
{
OpenFil2.getline(arr2,6,char_delim='\n');
counter2 = counter2 + 1;
}
strncpy(polkID, arr, 10);
strncpy(censusYr, arr2, 4);
strncpy(geoCode,&arrÕ10þ,6);
strncpy(unitCnt,&arrÕ16þ,9);
OpenFil3 << polkID << censusYr << geoCode << unitCnt << endl;
memset(arr,0,sizeof(arr));
x++;
if (x < 5)
{
cout << arr << endl; //displays the full record
cout << arr2 << endl; //displays the full record
cout << "what is the size of the array " << sizeof(arr) << endl;
cout << "what is the size of the array2 " << sizeof(arr2) << endl;
cout << "what is the polk id number " << polkID << endl;
cout << "what is the census year " << censusYr << endl;
}
if (x == 50000)
{
cout << "records read " << x << endl;
}
if (x == 100000)
{
cout << "records read " << x << endl;
}
if (x == 1000000)
{
cout << "records read " << x << endl;
}
if (x == 2000000)
{
cout << "records read " << x << endl;
}
if (x == 3000000)
{
cout << "records read " << x << endl;
}
if (x == 4000000)
{
cout << "records read " << x << endl;
}
if (x == 5000000)
{
cout << "records read " << x << endl;
}
if (x == 6000000)
{
cout << "records read " << x << endl;
}
if (x == 7000000)
{
cout << "records read " << x << endl;
}
memset(polkID,0,sizeof(polkID));
memset(geoCode,0,sizeof(geoCode));
memset(unitCnt,0,sizeof(unitCnt));
}
cout << "what is the number of records:" << counter << endl;
cout << "what is the number of record2:" << counter2 << endl;
OpenFile.close();
OpenFil2.close();
OpenFil3.close();
return 0;
}