Re: Why would "fopen(stdin,"rb")" fail?
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Tue, 21 Aug 2007 00:01:19 -0400
"David F" <David-White@xxxxxxxxxxxxx> wrote in message
news:%23XdsmP64HHA.1164@xxxxxxxxxxxxxxxxxxxx
I am doing the following:
fclose(stdin);
FILE* fp=fopen(stdin,"rb");
The compiler complains as follows:
error C2664: 'fopen' : cannot convert parameter 1 from 'FILE *__w64 '
to 'const char *'
What else did you expect?
Since it has no complain about the fclose(), why would it complain
about fopen?
Because fclose takes a FILE* (a handle to a file), while fopen takes a
char* (a file name).
My purpose is to check the input queue from keyboard, w/o waiting for
the user
See _kbhit, _getch
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: Why would "fopen(stdin,"rb")" fail?
- From: David F
- Re: Why would "fopen(stdin,"rb")" fail?
- References:
- Why would "fopen(stdin,"rb")" fail?
- From: David F
- Why would "fopen(stdin,"rb")" fail?
- Prev by Date: Re: L macro
- Next by Date: RE: Correct location for .PDB File when separating libs from binaries
- Previous by thread: Why would "fopen(stdin,"rb")" fail?
- Next by thread: Re: Why would "fopen(stdin,"rb")" fail?
- Index(es):