please dont rip this site

C++ Programming Example

Convert to Hex

Converts a character or string into a hexidecimal string. The use of std::string removes any need for dynamic allocation and pointer maintenance. From:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20525179.html

#include <string>
using namespace std;

string Byte2Hex(unsigned char c) {
const char *CnvTbl = "0123456789ABCDEF";
string S;

	S = CnvTbl[c >> 8];
	S += CnvTbl[c & 0x0F];
	return S;
	}

string String2Hex(const string &S) {
const int StrLen = S.length();
string Result;

	for (int i = 0; i < StrLen; ++i)
		Result  += Byte2Hex((unsigned char) S[i]);
	return Result;
	}



file: /Techref/language/ccpp/cppref/EXAMPLES/2hex_cc.htm, 1KB, , updated: 2006/3/31 15:33, local time: 2024/11/23 06:20,
TOP NEW HELP FIND: 
3.14.135.82:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/techref/language/ccpp/cppref/EXAMPLES/2hex_cc.htm"> C++ Programming Example Convert to Hex</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .