469,613 Members | 1,940 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

Output file prob

1,764 Expert 1GB
I'm making for fun a simple program which format a input file.Input file sustain of
person name,lastname and date of birth.Output file si supposed to be forammted as following:


And i finished it but there is little prob: it don't output date of birth!

I thinkt about the prob and can't figure out why is that happening.

To output data i used function: void output(void),i have also created a struct:
Expand|Select|Wrap|Line Numbers
  1. typedef struct person{
  2.                                            char lastname[20];
  3.                                            char firstname[20];
  4.                                            char dob[10];
  5.                                }Tperson;
And here is a problem:

Expand|Select|Wrap|Line Numbers
  1. Tperson person;
  3. while((!feof(data))&&(fgets(string,80,data)!=NULL))
  4. {
  5.      i=0;
  6.      j=0;
  7.     /*part with NAME and LAST name is working just fine so I don't think that   
  8.       this part is necsasary.*/
  9.      while(string[i]!=' '&&string[i]!='\t'&&string[i]!='\n')
  10.      {
  11.            temporary[j]=string[i];
  12.            i++;
  13.            j++;
  14.       }
  15.       temporary[j]='\0';
  16.       strcpy(person.dob,temporary);
  17.       fprintf(out,"\n %10s  %10s  %
  18.       6s  ",person.firstname,person.lastname,person.dob);
  20. }
Did anyone noticed where did I went wrong??

Mar 31 '07 #1
0 1195

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

17 posts views Thread by tom | last post: by
5 posts views Thread by David Sobey | last post: by
3 posts views Thread by Chad | last post: by
1 post views Thread by Jagadeesh | last post: by
12 posts views Thread by unique | last post: by
4 posts views Thread by Amit Maheshwari | last post: by
7 posts views Thread by pbd22 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.