Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 07-10-2003, 07:14 PM   #1 (permalink)
M3GAPL3X
Code Monkey
 
M3GAPL3X's Avatar
 
Join Date: Mar 2003
Location: California
Posts: 57
M3GAPL3X is on a distinguished road
Send a message via AIM to M3GAPL3X
Converting a character to hex?

Hi all,

I was doing some sample problems in my C++ book and I stumbled across this problem. It bascially wants any character converted to ascii. To my knowledge, there is no C++ function that does, so I probably need to make my own function. If anyone can give me some hints on solving this problem or creating a function, it would be greatly appreciated!
__________________
--------------------------
M3GAPL3X@linuxmail.org
M3GAPL3X is offline   Reply With Quote
Old 07-11-2003, 12:04 AM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
Re: Converting a character to hex?

Quote:
Originally posted by M3GAPL3X
It bascially wants any character converted to ascii.
i'll assume you mean 'converted to hex', not ascii (unless you're on a bcd machine, in which case you're beyond help).

well, that's pretty straightforward. you know each 8bit char can be represented as 2 hex characters. without writing the code for you, here are the steps you need:

split your char into "high" and "low" halves. each of these is one hex character (4 bits).
find a way to get the corresponding hexadecimal character of a 4 bit value.
joe_bruin is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with converting to HTML 4.01 Transitional gamehead200 HTML, XML, Javascript, AJAX 8 10-30-2004 09:06 AM
convert a String to hex sde Java 2 06-03-2004 07:35 AM
What's the windows-1252 character set for? verto Lounge 2 10-07-2003 03:57 PM
Character Counting Program DemosthenesB Standard C, C++ 8 04-03-2003 05:10 PM


All times are GMT -8. The time now is 11:00 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting