赞
踩
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
-
- int convert(char *myp, int mylen, int *Poutput)
- {
- int i = 0;
- char *pstart = myp + 1;
- char *Pstop = myp + mylen - 1;
- int ant = 0;
- int hex = 1;
-
- if(Pstop == NULL )
- {
- return -1;
- }
-
- if(myp == NULL)
- {
- return -1;
- }
-
- while(Pstop > pstart)
- {
- for(i = 0; i < mylen - 2; i++)
- {
- if(*Pstop >= 'A' && *Pstop <= 'F')
- {
- ant = ant + (*Pstop - 'A' + 10) * hex;
- }
- else
- {
- ant = ant + (*Pstop - '0') * hex;
- }
- Pstop --;
- hex = hex * 16;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。