![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Thanks Ooble.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#12 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Please look over that code and make sure you understand every single word of it.
|
|
|
|
|
|
#13 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Ok, I dont understand this part:
ch &= 0xDF;
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#14 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That can be stretched out to ch = ch & 0xDF;, or ch = ch & 223;. What this does is remove the third bit (from the left), making the character uppercase if it's a letter. You need to understand bit mathematics and the ASCII table to understand this. Basically, it's doing the same thing as ch = toupper(ch);.
|
|
|
|
|
|
#15 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
This goes back to a little thing called "clever" programming. I prefer longer, cleaner code that is easier to read. The issue with that, Ooble, is that I'd have to whip out a hex to binary converter and actually think for once. Why not just use toupper? Much easier for both parties.
|
|
|
|
|
|
#16 |
|
Programming Guru
![]() |
Ooble's code is more efficient but in this day and age efficiency is not required where as neat easy to unsderstand code it :/
|
|
|
|
|
|
#17 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
There's not much point in including an entire header file for one function. If you like, you can make your own toupper function:
char toupper (char ch)
{
return ch & 0xDF;
} |
|
|
|
|
|
#18 | |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Quote:
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
|
#19 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Exactly.
|
|
|
|
|
|
#20 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4
![]() |
Very nice and efficient, I never though of this to be honest!!, thanks Ooble.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|