By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

ASCII To Hex Converter

P: n/a
Good Evening,

I was wondering if anyone would be willing to help me code a ASCII to Hex
Converter, I'm very good at reading code, just not writing it, It is a bit
unfortunate, but any help would be great.
Jun 7 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jun 7, 11:54 am, "Matthew Eagle" <pttc...@dodo.com.auwrote:
Good Evening,

I was wondering if anyone would be willing to help me code a ASCII to Hex
Converter, I'm very good at reading code, just not writing it, It is a bit
unfortunate, but any help would be great.
You can search google...there are many code scripts which demonstrate
it..One link is:
http://www.phptr.com/articles/article.asp?p=31783&rl=1
Jun 7 '07 #2

P: n/a
On 7 Juni, 08:54, "Matthew Eagle" <pttc...@dodo.com.auwrote:
Good Evening,

I was wondering if anyone would be willing to help me code a ASCII to Hex
Converter, I'm very good at reading code, just not writing it, It is a bit
unfortunate, but any help would be great.
The basic idea:

#include <iostream>
#include <string>

int main()
{
std::string str = "Hello";

typedef std::string::iterator iter;
for (iter i = str.begin(); i != str.end(); ++i)
std::cout << std::hex << static_cast<int>(*i);
}

from there you should be able to work the rest out by yourself.

--
Erik Wikström

Jun 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.