Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:40:11+00:00 2026-05-23T17:40:11+00:00

I have to create BYTE* array that will store some text and binary data

  • 0

I have to create BYTE* array that will store some text and binary data for Http request.
Something like:

Content-Type: multipart/form-data; boundary=Asrf456BGe4h

--Asrf456BGe4h
Content-Disposition: form-data; name="DestAddress"
...
--Asrf456BGe4h
Content-Disposition: form-data; name="AttachedFile1"; filename="photo.jpg"
Content-Type: image/jpeg
...binary data... 

I’m afraid to use standard atl strings ’cause they truncate my binary files. How would you concatenate such things? I’d like to program like that:

DynamicArray arr();
arr.Add("Content-Type ... ");
arr.Add(imgContent, imgContentSize);
arr.Add("Content-Type...");

BYTE* buf;
arr.GetBits(buf);

Finally I should have BYTE* array. What ATL classes should provide me such functionality?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:40:11+00:00Added an answer on May 23, 2026 at 5:40 pm

    First, you can put raw data into an std::string with no risk of any problems occurring. It may confuse the reader, who expects std::string to contain text, but in specific cases (and inserting raw data into an HTTP response could be a valid example), it is justified.

    For the second, I’m not sure what you mean by “truncate my binary files”. If the file is written and read in binary mode, there should be no problem; there certainly isn’t on the systems I’m familiar with (Unix and Windows).

    Finally, while I’m not sure how BYTE is defined (probably—or at least hopefully—, it’s unsigned char). In that case, the simplest solution is probably to use an std::vector<BYTE> to build up the buffer. To append a string to it:

    buffer.append( str.begin(), str.end() );
    

    (The implicit conversion of char to unsigned char does the trick here.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application, basically, create a new byte array (less than 1K) store
I have create my own NSOpenGLView class, right now the data that i want
I have a program that has a byte array that varies in size, but
I have some numbers, encoded in byte array using variable-length code. Actually it's GIF89a
I have a bin file that I need to convert to a byte array.
I have to create a site definition for a client that must contain pre-defined
i have to create an asp.net page dynamically on runtime. It should work like
I am trying to wrap up some data from an array of BYTES into
I have some simple .NET objects I'd like to serialize to JSON and back
I have a very large array of doubles that I am using a disk-based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.