Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: An interest...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 8 Topic 26065 of 26977
Post > Topic >>

Re: An interesting c program for beginners

by "Bill Leary" <Bill_Leary@[EMAIL PROTECTED] > May 5, 2008 at 10:25 AM

Small nit:

"Niz" <niz@[EMAIL PROTECTED]
> wrote in message 
news:2008050513182216807-niz@[EMAIL PROTECTED]
> On 2008-05-05 12:23:26 +0100, apaticul@[EMAIL PROTECTED]
 said:
>>   printf("Social security number (no hyphens, just 3 figures): ");

Three figures?  All the SSN's I've seen are nine.

Did I miss something earlier in the thread where you wanted only three
digit 
****tion of the SSN?  If so, it seems the prompt should say so.

Also, I thought it wasn't guaranteed (assured? assumed?) that any output 
would occur without a newline or an fflush.  When I did stuff like this, I

used:

    printf("Social security number (no hyphens, just 9 figures): ");
    fflush(stdout);
    scanf("%d", ssn);

In cases where I forgot the fflush, for some platforms it worked as
desired 
anyway.  But on others, the prompts wouldn't appear until.  In most of
those 
cases the prompt appeared after I hit Enter for the input value, like
this:

    123456789Social security number (no hyphens, just 9 figures
    []

That [] represents the cursor at the beginning of the next line.

But I also remember one system where NONE of the prompts appeared at all. 
Then when I did a printf, which had a newline, all the prompts showed up
at 
the same time, followed by the printf text.  The cause being how the 
c-library and/or operating system did output buffering.

    - Bill
 




 8 Posts in Topic:
An interesting c program for beginners
apaticul@[EMAIL PROTECTED  2008-05-04 23:45:50 
Re: An interesting c program for beginners
Richard Heathfield <rj  2008-05-05 07:48:07 
Re: An interesting c program for beginners
"Malcolm McLean"  2008-05-05 09:26:35 
Re: An interesting c program for beginners
apaticul@[EMAIL PROTECTED  2008-05-05 04:23:26 
Re: An interesting c program for beginners
Niz <niz@[EMAIL PROTEC  2008-05-05 13:18:22 
Re: An interesting c program for beginners
"Bill Leary" &l  2008-05-05 10:25:32 
Re: An interesting c program for beginners
William Pursell <bill.  2008-05-05 13:15:45 
Re: An interesting c program for beginners
Nick Keighley <nick_ke  2008-05-06 03:58:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 3:43:26 CDT 2008.