Click here to Skip to main content
15,900,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help me description of class CXmlFile ! Pin
chybin28-Apr-06 21:36
chybin28-Apr-06 21:36 
GeneralRe: Help me description of class CXmlFile ! Pin
vnsoftware1-May-06 2:58
vnsoftware1-May-06 2:58 
Questionusing shockwave flash in dialog box Pin
chybin28-Apr-06 16:16
chybin28-Apr-06 16:16 
Questionhex to char Pin
borono28-Apr-06 13:03
borono28-Apr-06 13:03 
AnswerRe: hex to char Pin
cmk28-Apr-06 14:22
cmk28-Apr-06 14:22 
GeneralRe: hex to char Pin
borono28-Apr-06 14:44
borono28-Apr-06 14:44 
GeneralRe: hex to char Pin
cmk28-Apr-06 16:27
cmk28-Apr-06 16:27 
GeneralRe: hex to char Pin
borono28-Apr-06 16:58
borono28-Apr-06 16:58 
luckily no. I have the flow dripping --one at a time. 4E then FF, and on; till the end of time or size of transmission (which ever comes first). I thought, initially, I was to split, lets say 4E, making that value 4 and E, and it appears that is indeed the case. I think the function you gave should be good, so I will try it. i will let you know if it works, thanks for the examples.

-- modified at 23:44 Friday 28th April, 2006

Found here: http://users.powernet.co.uk/eton/kandr2/krx203.html

Slightly Modified Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int hexalpha_to_int(int c)
{
  char hexalpha[] = "aAbBcCdDeEfF";
  int i;
  int answer = 0;

  for(i = 0; answer == 0 && hexalpha[i] != '\0'; i++)
  {
    if(hexalpha[i] == c)
    {
      answer = 10 + (i / 2);
    }
  }

  return answer;
}

unsigned int htoi(const char s[])
{
  unsigned int answer = 0;
  int i = 0;
  int valid = 1;
  int hexit;

  if(s[i] == '0')
  {
    ++i;
    if(s[i] == 'x' || s[i] == 'X')
    {
      ++i;
    }
  }

  while(valid && s[i] != '\0')
  {
    answer = answer * 16;
    if(s[i] >= '0' && s[i] <= '9')
    {
      answer = answer + (s[i] - '0');
    }
    else
    {
      hexit = hexalpha_to_int(s[i]);
      if(hexit == 0)
      {
        valid = 0;
      }
      else
      {
        answer = answer + hexit;
      }
    }

    ++i;
  }

  if(!valid)
  {
    answer = 0;
  }

  return answer;
}

int conv(char *hex)
{
  char *endp = NULL;
  unsigned int result;
  unsigned int check;

    result = htoi(hex);
    check = (unsigned int)strtoul(hex, &endp, 16);

    if((*endp != '\0' && result == 0) || result == check)
    {
      printf("%u\n", result);
    }
    else
    {
     MessageBox(NULL,"Invalid hexadecimal value.",0,0);
    }
  
  return 0;
}

int main(void) 
{
	conv("4E");
	return 0;
}


solved, thank you
AnswerRe: hex to char Pin
Stephen Hewitt29-Apr-06 0:41
Stephen Hewitt29-Apr-06 0:41 
GeneralRe: hex to char Pin
borono29-Apr-06 11:37
borono29-Apr-06 11:37 
AnswerRe: hex to char Pin
Ryan Binns29-Apr-06 4:29
Ryan Binns29-Apr-06 4:29 
QuestionI need something about CButton Pin
vaskodrenoski28-Apr-06 12:23
vaskodrenoski28-Apr-06 12:23 
GeneralRe: I need something about CButton Pin
Laxman Auti28-Apr-06 18:27
Laxman Auti28-Apr-06 18:27 
AnswerRe: I need something about CButton Pin
Hamid_RT28-Apr-06 19:04
Hamid_RT28-Apr-06 19:04 
QuestionCButtonST bug, any fix? Pin
GrumbleWeedster28-Apr-06 11:27
GrumbleWeedster28-Apr-06 11:27 
AnswerRe: CButtonST bug, any fix? Pin
Rob Caldecott28-Apr-06 13:22
Rob Caldecott28-Apr-06 13:22 
QuestionPlatform SDK - Feb 2003 Pin
khb28-Apr-06 11:06
khb28-Apr-06 11:06 
AnswerRe: Platform SDK - Feb 2003 Pin
ThatsAlok28-Apr-06 23:32
ThatsAlok28-Apr-06 23:32 
QuestionRe: Platform SDK - Feb 2003 Pin
khb29-Apr-06 0:29
khb29-Apr-06 0:29 
QuestionConversion from Visual studio 6 to VC 2005 Pin
nahitan28-Apr-06 10:01
nahitan28-Apr-06 10:01 
AnswerRe: Conversion from Visual studio 6 to VC 2005 Pin
Nish Nishant28-Apr-06 10:19
sitebuilderNish Nishant28-Apr-06 10:19 
GeneralRe: Conversion from Visual studio 6 to VC 2005 Pin
nahitan1-May-06 3:22
nahitan1-May-06 3:22 
AnswerRe: Conversion from Visual studio 6 to VC 2005 Pin
Hamid_RT28-Apr-06 18:37
Hamid_RT28-Apr-06 18:37 
GeneralRe: Conversion from Visual studio 6 to VC 2005 Pin
nahitan1-May-06 3:22
nahitan1-May-06 3:22 
GeneralRe: Conversion from Visual studio 6 to VC 2005 Pin
Hamid_RT1-May-06 4:02
Hamid_RT1-May-06 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.