Re: [Boost-users] Exception on windows::stream_handle!
I would like to post the reason for this exception, may it will be useful for someone else :) The create file was not created with the "Overlapped IO attribute" It should look like this CreateFile(("MyFile",GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED,NULL); ----- Original Message ----- From: Lloyd To: boost-users@lists.boost.org Sent: Wednesday, May 26, 2010 2:35 PM Subject: Exception on windows::stream_handle! Hello, We are trying to create a "windows::stream_handle" from a native Windows HANDLE. But it throws an exception with "The parameter is incorrect". The code is given below. What could be the reason? (Another IOservice is already running in the system) HANDLE FileHandle=CreateFile("MyFile",FILE_WRITE_DATA,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); if(FileHandle==INVALID_HANDLE_VALUE) { return; } try { io_service ios; windows::stream_handle StreamHandle(ios,FileHandle); ... ... } catch(std::exception& e) { Log(e.what()); //The parameter is incorrect } Thanks, Lloyd ______________________________________ Scanned and protected by Email scanner
participants (1)
-
Lloyd