CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    China
    Posts
    27

    Serialize data to a buffer...

    I need a class such as this(just a demo):

    class CNetArchive
    {
    public:
    CNetArchive& operator << (int i);
    CNetArchive& operator << (float f);
    CNetArchive& operator << (string str);
    CNetArchive& operator >> (int i);
    CNetArchive& operator >> (float f);
    CNetArchive& operator >> (string str);
    protected:
    vector<UCHAR> m_vectorData;
    };

    It is used to serialize an object to serial data, then send to network, on the other side of network, use this data to create new object.

    May I get help from C++ stream library? How to do? Thanks!
    Last edited by esongs; September 11th, 2002 at 04:44 AM.

  2. #2
    Join Date
    Jun 2002
    Posts
    1,417
    If you mean transferring the data from one program to another located on different computers, (e.g. distributed processing) you have several options. The simplest is to just pass the structures via sockets. Other options are com/dcom and cobra.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured