int fd = _open("C:\\test_data\\testxml.xml", _O_CREAT | _O_RDWR);
xmlOutputBufferPtr output = xmlOutputBufferCreateFd(fd, NULL);
hello again,I investigated a bit more with my own compiled libxml2 in debug mode, the stack trace is:libxml2.dll!_invalid_parameter(const wchar_t * const _expression_, const wchar_t * const function_name, const wchar_t * const file_name, const unsigned int line_number, const unsigned int reserved) Line 91 C++libxml2.dll!_invalid_parameter_noinfo() Line 97 C++libxml2.dll!_write(int fh, const void * buffer, unsigned int size) Line 48 C++> libxml2.dll!__acrt_stdio_flush_nolock(_iobuf * public_stream) Line 152 C++libxml2.dll!_fflush_nolock(_iobuf * public_stream) Line 114 C++libxml2.dll!fflush(_iobuf * stream) Line 94 C++libxml2.dll!xmlFileFlush(void * context) Line 1104 Clibxml2.dll!xmlOutputBufferClose(_xmlOutputBuffer * out) Line 2606 CBest regards,SylvainOn Sat, Apr 16, 2016 at 11:25 AM, Sylvain Pointeau <sylvain pointeau gmail com> wrote:Hello,usingxmlOutputBufferPtr output = xmlOutputBufferCreateFilename("C:\\myfolder\testdata.xml", 0, 0);works...what can be wrong with xmlOutputBufferCreateFile?Best regards,SylvainOn Sat, Apr 16, 2016 at 10:23 AM, Sylvain Pointeau <sylvain pointeau gmail com> wrote:Hello,porting my program on windows, I noticed that xmlOutputBufferCreateFile raised a message I/O error : Bad file descriptor. Below is the sample program that crashes for me:FILE *f = fopen("C:\\myfolder\testdata.xml", "w");
xmlOutputBufferPtr output = xmlOutputBufferCreateFile(f, NULL);
xmlOutputBufferWriteString(output, "WHY DO YOU CRASH?");
xmlOutputBufferClose(output); <- at this moment it displays I/O error : Bad file descriptor
fclose(f);
I linked on libs pre-compiled for win32,I also tried with the lib I compiled myself, it even crashes in this case (it does not display IO error)Please note that the parsing (SAX) runs well.Do you have any idea? is it a bug or something I am not doing well?Best regards,Sylvain