Thread: How do you match 2 files?

  1. #1
    Registered User
    Join Date
    Sep 2001

    How do you match 2 files?

    I am reading in two files so that I can print a report.
    The 2 files have one thing in common and that is an Id number
    (CustomerId & orderId).

    I thought a simple if() statement would do it but it did not.
    How can I takle this problem????

    Thanks for your help..
    This is what I inserted in the report part:

    if(CustomerId = orderId)
    fprintf(summaryFilePtr, "%c %76s %c\n", 179, "", 179);
    	subTotal = installPrice - discountTotal;
    	tax = subTotal * TAX_AMT;
        total = subTotal + tax;
    	fprintf(summaryFilePtr, "%c %25s TOTAL %10s          $%03.2f   %13s %c\n", 179, "", "",
    		total, "", 179);
    	fprintf(summaryFilePtr, "%c %76s %c\n", 179, "", 179);
    	}//end if
    Imagination at Work

  2. #2
    Do both files have a customerID and orderID or does one file have a customerID and the other file have a orderID and they are just the same?

    The code that you posted had:
    if(CustomerId = orderId)

    This is setting CustomerID to what orderId equals (assignment)

    I think what you meant to say was:

    if(CustomerID == orderID) // the equality operator
    process file contents

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create Copies of Files
    By Kanshu in forum C++ Programming
    Replies: 13
    Last Post: 05-09-2009, 07:53 AM
  2. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  3. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 08:36 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. opening multiple files sequentially
    By moonwalker in forum C Programming
    Replies: 5
    Last Post: 08-20-2002, 09:57 PM