Re: Need Container for Large Binary String

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ivan Vecerina (INVALID_use_webform_instead_at_vecerina.com)
Date: 11/14/04

  • Next message: Maxim Yegorushkin: "Re: Need Container for Large Binary String"
    Date: 13 Nov 2004 23:32:27 -0500
    
    

    "floobles" <floobles@gmail.com> wrote in message
    news:d9632d0f.0411120912.7c9cdd5a@posting.google.com...
    > I need to manipulate large binary strings. I would like to use some
    > typical array functions (such as find first occurrence,
    > insert/replace, etc.)
    >
    > I would *like* to use either one of the MFC containers (CArray &
    > family) or STL (vector or STL strings).
    >
    > The STL string class would be ideal, except that all its functions
    > expect a '\0' as the end of the string, but my binary string will have
    > lots of '/0'...
    Some functions use null-terminated C strings, but all have an equivalent
    that allows you to embedd '\0'. I would suggest that you take a look
    through this ongoing thread in this NG:
      how to construct a string with embedded NULLs

    > Next ideal would be the STL vector, but it doesn't seem like there is
    > an efficient way in initializing the vector with my binary data (i.e.
    > the constructors don't take a char* and length as parameters .\_/. )
    > Is it possible to do a memcpy-type initialization? But this would
    > rely on the implementation (and not the interface) of the vector...

    A vector can be initialized using a memory range:

      std::vector v( myString, myString + myStringLength );

    hth,

    Ivan

    -- 
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
          [ See http://www.gotw.ca/resources/clcm.htm for info about ]
          [ comp.lang.c++.moderated.    First time posters: Do this! ]
    

  • Next message: Maxim Yegorushkin: "Re: Need Container for Large Binary String"

    Relevant Pages

    • Re: Need Container for Large Binary String
      ... > I need to manipulate large binary strings. ... > family) or STL (vector or STL strings). ... > The STL string class would be ideal, ... > an efficient way in initializing the vector with my binary data (i.e. ...
      (microsoft.public.win32.programmer.tools)
    • Re: Question to "Populating a pull down list in a .hta from AD"
      ... Dim strSunHrs, strMonHrs, strTueHrs, strWedHrs, strThuHrs ... Dim objShell, k, lngBiasKey, lngBias ... ' Convert 7 binary strings representing logon hours to a byte array. ... ' Offset binary string for local machine time zone bias. ...
      (microsoft.public.scripting.vbscript)
    • Re: Infinite Binary Strings: A Question
      ... binary strings as well as infinite binary strings. ... exist that cannot be characterized in less than a trillion bits, ... finitely many other members. ...
      (sci.math)
    • Re: Infinite Binary Strings: A Question
      ... binary strings as well as infinite binary strings. ... finitely many other members. ...
      (sci.math)
    • Re: Infinite Binary Strings: A Question
      ... binary strings, since any point produces a distinct string (sometimes there ... That defines an infinite binary ... but that there are uncountably many infinite binary strings. ... Uncountability refers to collections, not strings. ...
      (sci.math)