E
electrixnow
I am reading in a comma delimited text file, with a document #,revision
letter on each line.
example:
123,A
456,B
There are 19000 lines to this master document file. I will also be
reading in a file that has about 200 lines that has the same structure
as the first file. I need to compare File A and B and produce File C.
The 123 document data is the same in A and B file, I am looking if the
REVISION has been updated in the master document file A. If there is an
update of the REVISION then I want to copy that line of File A,
overwrite it in File B, and create file C with these lines that have
been found as updates.
The final program needs to take the data in file C and create a MS Word
Document, email it, and print it. This program will run once a day
after file A gets updated from a database query and act as an
automated document ordering system.
I am not the master of C by any means but I am trying my best to learn
more. I am more use to scripting from the 80's.
I am trying to use Visual C++ 2005 express
I am getting stuck with the following code because I get the an error
during compile when I try putting pointers into a new array that I have
commented out.
Here is the code that I am having problems with. Maybe I am going about
it the wrong way.
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MOVEX_QUERY "C:\\DWG_DATA\\DOCUMENTS_movex.dat"
int main(){
char * document;
char * edition;
char * str1;
char * next_token1;
int i=0;
string tmp;
using std::ifstream;
using std::cout;
ifstream inf(MOVEX_QUERY);
if (inf)
{
char namn[20000][30];
char doc[20000][30];
char edi[20000][30];
while ((inf.getline(namn, 30)) != NULL)++i;
for (int i = 0; i < 5; ++i){
str1 = namn;
document = strtok_s( str1, " ,\t\n", &next_token1);
edition = strtok_s( NULL, " ,\t\n", &next_token1);
// doc = document; // does'nt work
// edi = edition; // does'nt work
if(document == edition) printf( "%s\n", document ); // does'nt work
// printf( "%s\n", document );
// printf( "%s\n", edition );
// cout << i <<'\n';
}
}
else
{
cout << "Could not open file\n";
return 1;
}
cout << "PROCESSING COMPLETE\n";
return 0;
}
This is only some test code trying to read in and do comparisons on
variables. I was thinking that I could read in all of file A and B,
then loop thru A for each record of B while building C.
Any help Please!
letter on each line.
example:
123,A
456,B
There are 19000 lines to this master document file. I will also be
reading in a file that has about 200 lines that has the same structure
as the first file. I need to compare File A and B and produce File C.
The 123 document data is the same in A and B file, I am looking if the
REVISION has been updated in the master document file A. If there is an
update of the REVISION then I want to copy that line of File A,
overwrite it in File B, and create file C with these lines that have
been found as updates.
The final program needs to take the data in file C and create a MS Word
Document, email it, and print it. This program will run once a day
after file A gets updated from a database query and act as an
automated document ordering system.
I am not the master of C by any means but I am trying my best to learn
more. I am more use to scripting from the 80's.
I am trying to use Visual C++ 2005 express
I am getting stuck with the following code because I get the an error
during compile when I try putting pointers into a new array that I have
commented out.
Here is the code that I am having problems with. Maybe I am going about
it the wrong way.
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define MOVEX_QUERY "C:\\DWG_DATA\\DOCUMENTS_movex.dat"
int main(){
char * document;
char * edition;
char * str1;
char * next_token1;
int i=0;
string tmp;
using std::ifstream;
using std::cout;
ifstream inf(MOVEX_QUERY);
if (inf)
{
char namn[20000][30];
char doc[20000][30];
char edi[20000][30];
while ((inf.getline(namn, 30)) != NULL)++i;
for (int i = 0; i < 5; ++i){
str1 = namn;
document = strtok_s( str1, " ,\t\n", &next_token1);
edition = strtok_s( NULL, " ,\t\n", &next_token1);
// doc = document; // does'nt work
// edi = edition; // does'nt work
if(document == edition) printf( "%s\n", document ); // does'nt work
// printf( "%s\n", document );
// printf( "%s\n", edition );
// cout << i <<'\n';
}
}
else
{
cout << "Could not open file\n";
return 1;
}
cout << "PROCESSING COMPLETE\n";
return 0;
}
This is only some test code trying to read in and do comparisons on
variables. I was thinking that I could read in all of file A and B,
then loop thru A for each record of B while building C.
Any help Please!