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

  • Home
  • SEARCH
  • 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 8125263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:45:38+00:00 2026-06-06T06:45:38+00:00

I have a simple question but was not able to find an answer on

  • 0

I have a simple question but was not able to find an answer on the internet.
I am using the native WiFi API of Windows and trying to get the MAC of an access point.

Inside a structure of type WLAN_BSS_ENTRY there is a field named dot11Bssid which is basically an array of 6 unsigned chars.

What I want to do, is to have the MAC address in an std::string like this: ‘AA:AA:AA:AA:AA:AA’.

I can print the adress like this:

for (k = 0; k < 6; k++) 
{
    wprintf(L"%02X", wBssEntry->dot11Bssid[k]);
}

But I am unable to find a way of moving this values to a string with the format identified above.

Help is appreciated, if you wonder why do i want this in a string, I have the need to compare it with a string formatted that way.
Thanks in advance for your time.

  • 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-06T06:45:39+00:00Added an answer on June 6, 2026 at 6:45 am

    Use std::ostringstream (as already commented) with the IO manipulators. For example:

    #include <iostream>
    #include <sstream>
    #include <ios>
    #include <iomanip>
    #include <string>
    
    int main()  
    {
        unsigned char buf[] = { 0xAA, 0xD1, 0x09, 0x01, 0x10, 0xF1 };
    
        std::ostringstream s;
        s << std::hex << std::setfill('0') << std::uppercase
          << std::setw(2) << static_cast<int>(buf[0]) << ':'
          << std::setw(2) << static_cast<int>(buf[1]) << ':'
          << std::setw(2) << static_cast<int>(buf[2]) << ':'
          << std::setw(2) << static_cast<int>(buf[3]) << ':'
          << std::setw(2) << static_cast<int>(buf[4]) << ':'
          << std::setw(2) << static_cast<int>(buf[5]);
    
        std::cout << "[" << s.str() << "]\n";
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read this question and the simple and clear answer but it's not
I have a simple question, but searching on the internet didn't help me (maybe
I have a simple question, but I'm about 80% sure that the answer to
I've tried Google, but I can't find the answer to this simple question. I
This seems like a simple question, but I haven't been able to find the
My question is simple, but I haven't been able to find the question anywhere.
A simple question, yet I wasn't able to find an answer in google. How
Hopefully a question with a very simple answer, but it's not one that I've
I would suspect this is a simple question but I am not able to
I have a what seems to be a simple question but for the life

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.