GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ByteConvert_cpp/examples/bytes_to_string.cpp at master · SloCompTech/ByteConvert_cpp

Expand file tree

/

bytes_to_string.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
25 lines (20 loc) · 603 Bytes
/

bytes_to_string.cpp

Copy path

File metadata and controls

25 lines (20 loc) · 603 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <cstdint>
#include <cstring>
#include <string>
#include <ByteConvert/ByteConvert.hpp>
int main()
{
// Set array of bytes which we will convert to string
uint8_t block[8] = {0xfa, 0xca, 0xba, 0xba, 0xde, 0xda, 0xce, 0xca};
// Set expected string
std::string expected_string = "facababadedaceca";
// Convert bytes to string (8 is size of block)
std::string converted_string = ByteConvert::block_to_hex_string(block, 8);
// Check the result
if (converted_string != expected_string) {
// Error
return -1;
}
// Success
return 0;
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.