See title.
How do I achieve the opposite of this question: How do I get the file HANDLE from the fopen FILE structure?
I create the handle with
HANDLE h = CreateFile(name,
GENERIC_WRITE,
0,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
and then try to write some data to it using fputs
.
The call to fputs
fails on the line
_VALIDATE_STREAM_ANSI_RETURN(stream, EINVAL, EOF);
where stream
is the handle I obtained from CreateFile
.
The reason why I'm doing that is that I use an external library that uses FILE*
handles and I'm not opening a plain file (as until now) but trying to write to a pipe instead. And changing the external library is not an option.