Mr .Shannon first you read what is file Pointer because when you know File
pointer then clear error your self.

Because you are use file pointer to read the file

You read sequencly for example

You assume your file content (Expenses   500 600)

When you call fscanf read file where the current pointer in file

Initially pointer in staring of the file

File *Rp

 Rp ->Expenses

when you read Next pointer move to next

Rp ->500

and so on

Now comes to your file acct.dat

Rpà530

Rpà Interest Expense

Rp à  103.50

Rpà  255.20

Rpà   380.27

Rp à535

Rpà Legal expense

/* Note here */

Rpà 540

No information enter in file for legal expense

To correct this enter empty data for example

530   Legal expense                0.00    0.00    0.00



---

i think this information is enough to you

Don't  post again in this group regarding it..








2009/3/8 Shannon <[email protected]>

>
> This is C program. not C++.
>
> On Mar 5, 9:05 pm, Shannon <[email protected]> wrote:
> > its working account number 101-530 but it not working account number
> > 535-565
> > acct.dat
> > 101   Checking account #1     1032.57  2114.56  5219.23
> > 102   Checking account #2      543.78  3094.17  1321.20
> > 505   Advertising expense       25.00    25.00    25.00
> > 510   Auto expenses            195.40   307.92   501.12
> > 515   Bank charges               0.00     5.00     5.00
> > 520   Books and Publications    27.95    27.95    87.40
> > 525   Interest Expense         103.50   255.20   380.27
> > 530   Legal expense
> > 535   Miscellaneous expense     12.45    17.87    23.87
> > 540   Office expense            57.50   105.25   138.37
> > 545   Postage and shipping      21.00    27.63    57.45
> > 550   Rent                     500.00  1000.00  1500.00
> > 555   Supplies                 112.00   167.50   241.80
> > 560   Travel and entertainment  62.76   198.12   307.74
> > 565   Utilities                 84.89   190.60   278.48
> >
> > # include <stdio.h>
> > # include <ctype.h>
> > # define MAX 15
> >
> > struct account{
> >
> > int acctnum;
> > char accttitle[32];
> > float jan;
> > float mar;
> > float feb;
> >
> > };
> >
> > main ()
> > {
> > struct account bank[MAX];
> > FILE *rp;
> > int i=0;
> >
> > rp=fopen("acct.dat", "r");
> >
> > printf("%s%15s%13s%13s%13s\n","Acct No.","Account
> > title","Jan","Feb","Mar");
> >
> > for (i=0; i<MAX; i++){
> > fgets(bank[i].accttitle,32,rp);
> > fscanf(rp,"%f %f %f\n",&bank[i].jan,&bank[i].feb,&bank[i].mar);
> > fscanf(rp,"\n");
> > fflush(stdin);}
> >
> > for (i=0; i<MAX; i++)
> > {
> > printf("%s %-13.2f %-13.2f %-13.2f\n ",bank[i].accttitle,bank
> > [i].jan,bank[i].feb,bank[i].mar);
> > fprintf(rp,"%d",bank[i].acctnum);
> > fscanf(rp,"\n");
> > fflush(stdin);
> >
> >
> >
> > }
>  > }- Hide quoted text -
> >
> > - Show quoted text -
>



-- 
Regards
*******************
*C.Arun Kumar *
*******************

Reply via email to