Note that there are some explanatory texts on larger screens.

plurals
  1. PORead\write boost::binary_oarchive to pipe
    text
    copied!<p>I am continue to build two simple processes throwing class objects one to another (see my previous post) through simple (anonymous) pipes. Now I revealed for myself boost::serialization (thanks answered people) and have tried to make some class be serialized through ::WriteFile::ReadFile. So - what I am doing wrong?</p> <hr> <p>1) I created some class</p> <pre><code> #pragma once #include "wtypes.h" #include &lt;boost\archive\binary_oarchive.hpp&gt; #include &lt;boost\archive\binary_iarchive.hpp&gt; #include &lt;boost\serialization\binary_object.hpp&gt; class CTextContainer { friend class boost::serialization::access; template&lt;class Archive&gt; void serialize(Archive &amp; ar, const unsigned int version) { ar &amp; m_sText; ar &amp; m_dwCRC; ar &amp; m_dwSize; } public: CTextContainer() : m_dwCRC(0), m_dwSize(0) { ZeroMemory(m_sText, sizeof(m_sText)); m_dwSize = sizeof(*this); } CTextContainer(LPCTSTR sText) : m_dwCRC(0), m_dwSize(0) { ZeroMemory(m_sText, sizeof(m_sText)); wcsncpy_s(m_sText, 1024, sText, wcslen(sText)); m_dwSize = sizeof(*this); } virtual ~CTextContainer(){} LPTSTR GetText() const{return (LPTSTR) m_sText;} protected: DWORD m_dwCRC; DWORD m_dwSize; TCHAR m_sText[1024]; }; //end of class </code></pre> <p>2) And now I am trying to read from this class into binary archive and to write its content to one end of pipe... </p> <pre><code>boost::archive::binary_oarchive oa(ofs); oa &lt;&lt; tc; ::WriteFile(hPipe, &amp;oa, dwRead, &amp;dwWritten, NULL) == FALSE </code></pre> <p>It won't work in that way, right? So, how it will?</p> <p>3) Same operation on other side?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload