473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to convert a uint32_t to Ascii in C.

I have a uint32_t variable. I want to prints it ASCII equivalent.
can anyone help me here.
May 13 '16 #1
6 6140
weaknessforcats
9,208 Expert Mod 8TB
Move the uint32_t to a char variable and print the char.

Originally, the char was to hold one character of the implementation code set used to implement C++. In this case the implementation character set is ASCII. So printing a char with 65 in it prints an A whereas printing a unint32_t will print 65.
May 14 '16 #2
donbock
2,426 Expert 2GB
Does your uint32_t variable have the value of an ASCII character (for example 65)?
If so, are you concerned with this print function working on a platform that does not use ASCII? That is, do you need to convert ASCII to the native character set?

Or does your uint32_t variable have an arbitrary value that you want to print in decimal or hexadecimal?
May 14 '16 #3
that variable has an arbitrary value which is pretty large. for eg. "1295069243" in decimal.
Now i want to print its ASCII equivalent.
May 14 '16 #4
weaknessforcats
9,208 Expert Mod 8TB
The ASCII equivalent of 65 is A. If you look at the ASCII table, all printable values are between 40 and 126.

There is no ASCII equivalent to 1295069243. What you have here is a decode of the bits in the uint32_t into a string of digits. In this case you can just display the unit32_t.
May 14 '16 #5
Thanks for your response. do you have any example for that?
May 14 '16 #6
donbock
2,426 Expert 2GB
Take a look at printf.
May 15 '16 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bert | last post by:
How do I convert an ascii to hex? I want the hex stored in a variable, not just printed out. For example, my testchars = 'CICS003' How do I store that value in hexchars? I know this is basic,...
12
by: David Williams | last post by:
Hi all, i have been able to convert an ASCII character to an INT however im lost as to how to change them back. Cant find anything on the net (though im probably looking in the wrong places!)....
6
by: Friso Wiskerke | last post by:
Hi all, I'm creating a fixed length textfile with data which is sent out to a third-party which in turn reads the file and processes it. Some of the characters are not part of the lower ASCII...
1
by: keithb | last post by:
How can I convert an ascii code into a character using C# in ASP.NET? Thanks, Keith
24
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special...
7
by: Joris De Groote | last post by:
Hi, I have a 1 dimensional table byte with a number af characters in ASCII code. How do I convert those ASCII codes to real letters? Thanks
1
by: Guru123 | last post by:
Pleease give me your valuable solution early as far as possible
1
by: tedpottel | last post by:
Hi, Newbe needs help, How can I convert a ascii code to a charter?? -Ted
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
2
by: arunak11 | last post by:
Hi any one help me in converting ascii value entered by user. How to convert it to float basic of c programming techniques only help me
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.