fprintf("Student Name SSN DOB CURR GRAD Yr");
Did you forget where you want the be printed?.
fprintf(out,"Student Name SSN DOB CURR GRAD Yr");
Also
fprintf(out,"%-30s\n %03d-%02d-4d\n %15s\n %8s\n %8d\n", s->name,f,m,l,s->dob,s->curr,s->gradyr);
If you don't take away the \n after every format operator you will have this:
John Jones
123-45-6789
04-19-1978
CIS
2009
fprintf(out,"%-30s %03d-%02d-%4d %15s %8s %8d\n", s->name,f,m,l,s->dob,s->curr,s->gradyr);
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
Now to tackle why the ssn is not printing the way it should.
Could you post what is it that prints?.
Did you notice in my previous post the little correction I did to the last fprintf?. You were missing a
% between %2d and 4d I think.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
The reason that the social security number is not shown, is because
your program is protecting you from showing to everyone in
Daniweb, the social of so many people. :cheesy: You have build-in encription in your program. I'm joking!.
I can see that the print format is correct now. So the pro
blem is that f, m, and l, is not recieving the correct information
s->ssn = atoi( p);
f = ssn/1000000;
ssn=ssn%1000000;
m=ssn/10000;
l=ssn%10000;
What is the value store in f, m, and l if ssn doesn't contain
the information that you think?. What is in ssn before you try to
divide the digits?.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218