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 12-04-2004, 07:36 PM   #1 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
String Conversion

Is there any way in C++ to convert ASCII strings to a Bin or Hex value?
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-04-2004, 11:15 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
What do you exactly mean?
__________________
Valmont is offline   Reply With Quote
Old 12-05-2004, 06:45 PM   #3 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
Well, if I have a string of characters, can I get the ASCII value of each character some way?

Let me explain what I'm wanting to do. I have a string array holding cards from a deck. 2-A and the ASCII characters 0x0003-6. since it's in a string, I'm having a bit of trouble comparing the values against each other. I thought if I could get them in Bin or Hex, it would make my comparisions easier.
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-05-2004, 10:21 PM   #4 (permalink)
Rotkiv
Code Monkey
 
Rotkiv's Avatar
 
Join Date: Apr 2004
Location: Silicon Valley, CA
Posts: 64
Rotkiv is on a distinguished road
Send a message via AIM to Rotkiv Send a message via MSN to Rotkiv
would making them duel array's, one with the string and one with a number value work?
Rotkiv is offline   Reply With Quote
Old 12-06-2004, 06:07 AM   #5 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Quote:
Originally Posted by Kernel_Killer
Well, if I have a string of characters, can I get the ASCII value of each character some way?

Let me explain what I'm wanting to do. I have a string array holding cards from a deck. 2-A and the ASCII characters 0x0003-6. since it's in a string, I'm having a bit of trouble comparing the values against each other. I thought if I could get them in Bin or Hex, it would make my comparisions easier.
If you are using std::string then you can compare strings directly:

string a("hullo");
string b("hello");
if( a == b )
{
//--
}
__________________
Valmont is offline   Reply With Quote
Old 12-06-2004, 09:28 AM   #6 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
I'm aware of the string comparision, it's just for this in particular I need to compare with bits, or nex values. My ASCII characters are also going to play a part in the comparision.
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 12-14-2004, 10:26 AM   #7 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
OK, I found out how to do this in *ack* .NET, but not ANSI. I'll post later if I can find a way.
__________________
Network Synapse
Screaming Electron
Kernel_Killer 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 for another program Androto Standard C, C++ 54 10-15-2004 08:21 AM
GUID to string conversion milena Platform/API C++ 1 09-14-2004 01:04 PM
From C to Java HighterDK Java 11 07-13-2004 08:15 PM


All times are GMT -8. The time now is 06:28 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