

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert Hexadecimal value String to ASCII value String in C++
In this tutorial, we will be discussing a program to convert hexadecimal value string to ASCII value string.
For this we will be provided with a string with some hexadecimal values. Our task is to get that hexadecimal value and convert it into equivalent ASCII values.
Example
#include <bits/stdc++.h> using namespace std; string convert_ASCII(string hex){ string ascii = ""; for (size_t i = 0; i < hex.length(); i += 2){ //taking two characters from hex string string part = hex.substr(i, 2); //changing it into base 16 char ch = stoul(part, nullptr, 16); //putting it into the ASCII string ascii += ch; } return ascii; } int main(){ cout << convert_ASCII("6176656e67657273") << endl; return 0; }
Output
avengers
- Related Questions & Answers
- Convert a string to hexadecimal ASCII values in C++
- Convert the ASCII value sentence to its equivalent string in C++
- Convert double value to string in Java
- How to convert a boolean value to string value in JavaScript?
- Convert DateTime Value into String in MySQL?
- Java Program to convert ASCII code to String
- JavaScript - convert array with null value to string
- Java Program to convert an int value to String
- How to convert value to string using $toString in MongoDB?
- How to convert a Date value to string in JDBC?
- How to convert a double value to String in Java?
- How to convert a value to a string in JavaScript?
- Replacing all special characters with their ASCII value in a string - JavaScript
- How to convert an integer to an ASCII value in Python?
- Java Program to convert string value to float using Float.valueOf()
Advertisements