Click here to Skip to main content
15,915,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
printf("Enter the data\n");
fgets(buffer,250,stdin);

i use the function above like that to get a value form the user and store in the buffer varriable(its a character array).

i want to know how to assign the stdin file pointer to the other file pointer

and how to read the data from that file pointer..

please..

i want to use that function only..
Posted

You can't write to stdin: it is a read-only stream. It would be the equivalent of writing to your mouse and expecting the user to read the message...
You could use fprintf to write to stdout:
fprintf(stdout, "Enter the data\n");
fgets(buffer,250,stdin);
But printf is the equivalent of that anyway - many implementations do exactly that: call fprintf from printf with stdout as the stream parameter.
 
Share this answer
 
This is (at least) the third time you have asked this question, and the answer remains the same:
1. You cannot write to stdin.
2. You cannot read from stdout.

I get the distinct impression that your question does not really explain what you are trying to do, so maybe a bit more detail on what problem you are trying to solve would get you a better answer.
 
Share this answer
 
Comments
@BangIndia 2-Jul-11 5:46am    
ok. thanks..........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900