read in from 2 files

This is a discussion on read in from 2 files within the C Programming forums, part of the General Programming Boards category; Hi,everybody. I cannot create nice code for reading in from 2 files into 2 structures.One file is having master records,another ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    3

    Exclamation read in from 2 files

    Hi,everybody.
    I cannot create nice code for reading in from 2 files into 2 structures.One file is having master records,another has transaction records(several transactions for each record in master).I can only move to another record in master when I read all records in transactions for the first record.
    I'll appreciate anybody's help.

    thanks.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Apparently you can't create any code, because I don't see your attempt any place...

    One more time people: This is not a "do everything for me" forum. This is a "here's what i'm done, here's what i'm having problems with, here's what i need, can you please help" forum.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    TK
    Guest
    Code:
    struct master
    {
       //data types
    }Master_t;
    
    struct tranaction
    {
      //data types
    }Trans_t;
    
    int main()
    {
      FILE *fptr_a;
      FILE *fptr_b;
      int status;
     
      fptr_a = fopen("master","r");
      if(fptr_a == NULL) exit(1);
    
      fptr_b = fopen("transaction","r");
      if(fptr_b == NULL) exit(1);
    
      //read records
      //There are different methods for reading records
      //The easiest is using fscanf, however it is not the best
      return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read Only files
    By DominicTrix in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2004, 01:55 AM
  2. using threads to write & read from files
    By kishorepalle in forum C Programming
    Replies: 4
    Last Post: 10-19-2004, 05:19 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. trying to read all asci char's in files
    By brane_sail in forum C++ Programming
    Replies: 1
    Last Post: 09-02-2002, 11:33 AM
  5. Replies: 1
    Last Post: 07-24-2002, 06:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21