PDA

View Full Version : How do I match 2 files to print data.



sketchit
11-12-2001, 05:45 PM
I am having problems getting two file to match once they have been sorted. The 2 files have one record in common and that is an Id number(CustomerId and orderId).
CustomerId File contains:

CustomerId
CustomerFirstName
CustomerMiddleName
CustomerLastName
CustomerAddress
CityStateZip
CustomerPhoneNo
CustomerEmailAddress

order file contains:

orderId
length
width
carpetCharge
discount

The 2 Id numbers match but the wrong information is being printed from the CustomerId file.

Any ideas?

The following is what I have:



if(CustomerId = orderId)
{
fprintf(processFilePtr, "%c", 179);
fprintf(processFilePtr, "Customer Id: %9s %53s %c\n", CustomerId, "", 179);
fprintf(processFilePtr, "%c", 179);
fprintf(processFilePtr, "Order Id: %9s %56s %c\n", orderId, "", 179);
fprintf(processFilePtr, "%c %76s %c\n", 179, "", 179);
fprintf(processFilePtr, "%cFirst Name: %10s %53s%c\n", 179, CustomerFirstName, "", 179);
fprintf(processFilePtr, "%cMiddle Name: %10s %53s%c\n", 179, CustomerMiddleName, "", 179);
fprintf(processFilePtr, "%cLast Name: %10s %52s %c\n", 179, CustomerLastName, "", 179);
fprintf(processFilePtr, "%c %76s %c\n", 179, "", 179);
fprintf(processFilePtr, "%cAddress: %25s %37s %c\n", 179, CustomerAddress,
"", 179);
fprintf(processFilePtr, "%c %25s %37s %c\n", 179, CityStateZip,
"", 179);
fprintf(processFilePtr, "%c %76s %c\n", 179, "", 179);
fprintf(processFilePtr, "%cPhone No: %15s %45s %c\n", 179, CustomerPhoneNo,
"", 179);
fprintf(processFilePtr, "%cEmail Address: %25s %35s %c\n", 179, CustomerEmailAddress,
"", 179);
fprintf(processFilePtr, "%c", 195);
HorizontalLine(processFilePtr);
fprintf(processFilePtr, "%c\n", 180);
fprintf(processFilePtr, "%c", 179);
fprintf(processFilePtr, "%37s MEASUREMENT %28s", "", "");
fprintf(processFilePtr, "%c\n", 179);
if(CustomerId = orderId)
{
fprintf(processFilePtr, "%c %76s %c\n", 179, "", 179);
fprintf(processFilePtr, "%c %25s Length %20s %d ft %16s %c\n",
179, "", "", length, "", 179);
fprintf(processFilePtr, "%c %25s Width %21s %d ft %16s %c\n",
179, "", "", width, "", 179);
fprintf(processFilePtr, "%c %25s Area %21s %d ft %16s %c\n",
179, "", "", area, "", 179);
}//end if