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 9155365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:34:53+00:00 2026-06-17T12:34:53+00:00

As the title says I try to convert to byte data type a C++

  • 0

As the title says I try to convert to byte data type a C++ String of Bytes and count bytes.
The string I get from textbox will contain a series of one byte hexadecimal numbers, but I need to send it as bytes.

char packet_data[200];
HWND hTextBox2 = GetDlgItem(TabOneDlg,IDC_EDIT3);

SendMessageA(hTextBox2, WM_GETTEXT, (WPARAM)200, (LPARAM)packet_data);

That’s how I get the input value (I am using win32 API – unmanaged forms)

EXAMPLE of input string (hex)

AA BB CC DD - 4 bytes !

In SHORT I want to do this :
Got a string containing a textual representation of hexadecimal numbers, and I want to convert each textual representation of the hexadecimal numbers to “normal” numbers.

  • 1 1 Answer
  • 0 Views
  • 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-06-17T12:34:54+00:00Added an answer on June 17, 2026 at 12:34 pm

    If you are sure that the hexadecimal numbers are separated by a space (as shown in the question) it is a simple question of extracting them. The simplest way in C++ is by using std::istringstream and the normal input operator >>:

    std::istringstream istr(packet_data);
    std::vector<uint8_t> data;
    
    uint8_t i;
    while (istr >> std::hex >> i)
        data.push_back(i);
    

    After the above code, the vector data will have all data from the string. If you need to e.g. send the data over a socket (or similar) you can use std::vector::data to get a raw pointer to the data (or use &data[0] if the data function doesn’t exist), and the number of bytes is available from std::vector::size.

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

Sidebar

Related Questions

Title says all. Sample code: ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object>
as the title says, I keep getting undefined when I try to get the
This is my try to get records below the date: SELECT Title, XXXX from
As the title says I get a NullPointerException when I try to get a
As title says for some purpose I need to get the size of request/response
As the title says. My UIViewController will not rotate no matter what. When it
Like the title says I am getting an error when I try to run
Just as the title says I have a copy of Selenium - installed from
As the title says, i try to add a jquery hover effect to different
As the title says, my project will never bring up the FB login screen

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.