C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 11th, 2005, 03:56 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Lightbulb Nice little hack I thought I'd share...

Just made this little kluge for a project at work, thought I'd share.

c Code:
Original - c Code
  1. unsigned char *h;
  2. unsigned int d;
  3.  
  4. for(d = 0 ; isxdigit((int) *h); h++)
  5.     d = (d << 4) + (0x0F & *h) + ((0x40 & *h) ? 9 : 0);


1 reputation point to the first one to tell me what it does. (2 if you do it without compiling and running it).
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 592

Reply With Quote
  #2  
Old October 12th, 2005, 01:05 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Hmmm. Im still thinking. lol. I see the inline if else and stuff but, , Well, I guess Im going to go compile this now and see what I can come up with How bout a little clue.

Reply With Quote
  #3  
Old October 12th, 2005, 01:11 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Try making the string h something like "Babe", or "1334", or "C0ffee"

Reply With Quote
  #4  
Old October 12th, 2005, 01:16 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 24 m 9 sec
Reputation Power: 14
lol, brilliant block of code
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips.



Reply With Quote
  #5  
Old October 12th, 2005, 01:21 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Quote:
Originally Posted by B-Con
lol, brilliant block of code
You know what it does then?

Reply With Quote
  #6  
Old October 12th, 2005, 04:47 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 24 m 9 sec
Reputation Power: 14
Yep. I had to compile it and run it to figure it out, though, since it was a tard hard to process mentally.

How long did it take you to write that?

Reply With Quote
  #7  
Old October 12th, 2005, 09:15 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Honestly? less than 10 minutes...and that's including the rest of the function, which I'll post once Geo has figured it out .
What can I say...I like to think in binary one of the perks of working with MC's I guess...

Reply With Quote
  #8  
Old October 12th, 2005, 09:40 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Well, you better post it then because if you wait for me we might be here a while, lol. I tried compiling it and it crashed during run time. Maybe thats because I put it in the main block and then compiled it, that is writing a C++ console app. . So, lets have it. I am interested at what it does. Im just not far enough along to make out what its for.

Reply With Quote
  #9  
Old October 12th, 2005, 09:45 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
It crashed? typical...

It needs the ctype.h library, and you need to assign a string to the *h pointer..., like:
Code:
unsigned char *h = "Babe";

And then you need to read the value of d at the end of course...

Reply With Quote
  #10  
Old October 12th, 2005, 09:46 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Hey! You went pro! Sig and avatar privs!
Congratulations!

Reply With Quote
  #11  
Old October 12th, 2005, 09:49 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Ya, I'm so excited, I could pop. lol
Comments on this post
B-Con agrees: For your new avatar and sig
__________________
---Official Member Of The Itsacon Fan Club---
Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat all day drinking beer.

Reply With Quote
  #12  
Old October 12th, 2005, 09:55 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Cool sig!!!

Reply With Quote
  #13  
Old October 12th, 2005, 09:57 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
It's wierd man I keep getting the error cannot assign a const to an unsigned, when I try to assign babe to it. =(

Ya thought you would like that one =)

Here's What I got
Code:
#include <cstdlib>
#include <iostream>
#include <ctype.h>
using namespace std;

int main(void)
{
  unsigned char *h = "babe";
  unsigned int d;

     for(d = 0 ; isxdigit((int) *h); h++)
	   d = (d << 4) + (0x0F & *h) + ((0x40 & *h) ? 9 : 0);
    system("PAUSE");
    return EXIT_SUCCESS;
}

Last edited by Geo.Garnett : October 12th, 2005 at 10:02 PM.

Reply With Quote
  #14  
Old October 12th, 2005, 10:02 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
try this:
c Code:
Original - c Code
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int main()
  5. {
  6.     const unsigned char *h = "Babe";
  7.     unsigned int d;
  8.  
  9.     for(d = 0 ; isxdigit((int) *h); h++)
  10.         d = (d << 4) + (0x0F & *h) + ((0x40 & *h) ? 9 : 0);
  11.        
  12.     printf("%d\n", d);
  13.     return 0;
  14. }

Last edited by Itsacon : October 12th, 2005 at 10:04 PM.

Reply With Quote
  #15  
Old October 12th, 2005, 10:17 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Are you suppose to get 47806? I changed it for unsigned to just a char and then it worked. But then I played around with what type of string went into it and it came up with other wierd numbers. What would you use a piece of code like this for?

Last edited by Geo.Garnett : October 12th, 2005 at 10:20 PM.

Reply With Quote
  #16  
Old October 12th, 2005, 10:32 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
yo also me i have to take the unsigned off so it will compile and then the exe came but when i opened it it closes
just want to know whats this for

Reply With Quote
  #17  
Old October 12th, 2005, 10:34 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
put a system("PAUSE");, or a cin.get(); in there bloodlust, and haven't seen you around in a while, how ya been.

Last edited by Geo.Garnett : October 12th, 2005 at 10:37 PM.

Reply With Quote
  #18  
Old October 12th, 2005, 10:37 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
fine yo i tried other things but forgot about that one lol especially when i use that alot of times

Reply With Quote
  #19  
Old October 12th, 2005, 10:40 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Ya Im sure its been awhile for ya, I get like that too if I haven't done anything for like a week or two. lol

Reply With Quote
  #20  
Old October 12th, 2005, 10:42 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
nope doesnt work the system PAUSE
lol yo not to make fun of u but i bet you quit on the chess program

Reply With Quote
  #21  
Old October 12th, 2005, 10:43 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
What chess program lol

if you use it like this it will work
Code:
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <ctype.h>
using namespace std;

int main(void)
{
  char *h = "babe";
  unsigned int d;

     for(d = 0 ; isxdigit((int) *h); h++)
	   d = (d << 4) + (0x0F & *h) + ((0x40 & *h) ? 9 : 0);
    printf("%d\n", d);
    system("PAUSE");
    return EXIT_SUCCESS;
}

Last edited by Geo.Garnett : October 12th, 2005 at 10:45 PM.

Reply With Quote
  #22  
Old October 12th, 2005, 10:43 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
also how u got an avater?

Reply With Quote
  #23  
Old October 12th, 2005, 10:48 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
Well, once you get enough cool points and every one else agree's that you have reached the coolness standard to have one, they let you upload an image.

Reply With Quote
  #24  
Old October 12th, 2005, 10:51 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
But seriously you can read my entire thread and find out what it takes to get an avatar or its both: ((days >= 90 days) && (posts >= 100))

http://forums.devarticles.com/t32042/s.html

Reply With Quote
  #25  
Old October 12th, 2005, 10:56 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
well with my warnings i am never going to lol
k
now it says
press any key to continue...

and i know this is from the system("PAUSE")

and come on y doesnt he just put the purpose of the code in we will be all happy

yo geo not that it is my business but what project are u working on like what will the program do

Reply With Quote
  #26  
Old October 12th, 2005, 10:59 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 13
Send a message via AIM to Geo.Garnett
not my program boss I was just one of the guys trying to figure out what it does. And the project I'm working on is just re-reading alot of my text and stop trying to write programs that are out of my league because it is only slowing me down. lol

Reply With Quote
  #27  
Old October 12th, 2005, 11:10 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 13 m 30 sec
Reputation Power: 13
Send a message via Yahoo to BloodlustShaman
oh I know this is not ur code itsacon code

but yeah thats a good idea also u got an class of coding?

I am going to do that later in the future of looking at code but currently i picked a good book

C++ for Dummies

lol yup that one and it really helps and kinda with the knowledge i got from the other book it helps me a lot but i am learning alot from this book more than the other and it explains good well then it seems i am a dummie lol

Reply With Quote
  #28  
Old October 18th, 2005, 07:33 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 55 m 59 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
The full function

Well, here's the full function, as promised:
cpp Code:
Original - cpp Code
  1. int htoi(const char *hex)
  2. {
  3.     // declarations
  4.     int dec;
  5.  
  6.     // skip leading whitespace
  7.     while(isspace((int) *hex))
  8.         hex++;
  9.  
  10.     // check for presence of "0x" header
  11.     if((hex[0] == '0') && (hex[1] == 'x'))
  12.         hex += 2;
  13.  
  14.     // run conversion
  15.     for(dec = 0; isxdigit((int) *hex); hex++)                     // Yes, this converts hex ascii digits to an integer.
  16.         dec = (dec << 4) + (0x0F & *hex) + ((0x40 & *hex) ? 9 : 0);  // Don't you just love bitwise operators? :-)
  17.        
  18.     // return integer
  19.     return dec;
  20. }


Note that what this function does can also be done with the strtol() function, but this one is faster, and uses less parameters (speed through specialisation).

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Nice little hack I thought I'd share...


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap