> ----- Original Message ----- 
> From: "andrew clarke" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Saturday, June 07, 2008 5:13 PM
> Subject: Re: [c-prog] verifiying input
>
>> It's not at all clear what you're trying to do here.  Your e-mail has
>> no context, and your code is insufficient commented.
>>
>> You are not using the 'buf' array, and you are treating the 'input'
>> variable as a string when it is a single char.  fgets expects a char
>> array as the first parameter, so consequently your code will not
>> compile.
>
>    Parameter 2 of fgets is an int. Parameter 1 takes a pointer to char. 
> One
> could try this.

    OK. I see what you mean now. Let me try this. instead.

> int main(void) {
>     int buf[10];
>     char *input;  /* for parameter 1 */
>     fgets( input, sizeof(buf), stdin );
>     printf( "%s\n", input );
> }
>
> This should, and this is untested, print a string from input.
>
> Bill
>
> 

Reply via email to