CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Faltering Windows support
  • Internet Explorer 8 Click Clever Click Safe
  • Release Candidate 2 for ASP.NET MVC 2
  • Learn How to Create Dual Mode Windows Services

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C++ (Non Visual C++ Issues) Ask or answer C and C++ questions not related to Visual C++. This includes Console programming, Linux programming, or general ANSI C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old November 20th, 2009, 03:41 PM
    mop65715 mop65715 is offline
    Member
     
    Join Date: Dec 2005
    Posts: 379
    mop65715 is an unknown quantity at this point (<10)
    binary input and output stream

    I'm trying to put together a class or (suite of classes) that'll support reads and writes in binary form into an input and output stream respectively. The class will also support automatic conversion from big-endian (network byte order) to little-endian and vice-versa. The question: I need design guidance on how I could setup the class such that I'll have support for both file I/O (read/writes to a file) and/or a vector - of say unsigned char. For instance.

    Code:
    typedef std::vector < unsigned char > uchar_vec ;
    int main() {
      unsigned short a ( 0 ); 
      unsigned short b ( 0 ); 
      uchar_vec my_vec ( 4 ) ; 
      contents_from_my_vec_to_shorts >> short_a >> short_b ; 
    
      contents_from_shorts_to_myvec << short_a << short_b ; 
    
    
    }

    Last edited by mop65715; November 20th, 2009 at 08:55 PM.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ (Non Visual C++ Issues)


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 10:59 AM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.